Bird
0
0

Identify the syntax error in this logging function:

medium📝 Troubleshoot Q6 of 15
Agentic AI - Agent Observability
Identify the syntax error in this logging function:
def log_tool(tool, result):
    print(f"Starting {tool}..."
    print(f"Outcome: {result}")
AIndentation error in the second print statement
BIncorrect use of f-string syntax
CUsing print instead of return
DMissing closing parenthesis in the first print statement
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax

    The first print statement lacks a closing parenthesis.
  2. Step 2: Validate other options

    f-string syntax is correct; print is appropriate; indentation is consistent.
  3. Final Answer:

    Missing closing parenthesis in the first print statement -> Option D
  4. Quick Check:

    Every print needs matching parentheses [OK]
Quick Trick: Check matching parentheses in print statements [OK]
Common Mistakes:
  • Assuming f-string syntax is wrong
  • Confusing print with return
  • Overlooking missing parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes