Bird
0
0

What is wrong with this logging function?

medium📝 Troubleshoot Q14 of 15
Agentic AI - Agent Observability
What is wrong with this logging function?
def log_call(tool, result):
    print("Calling tool...")
    print("Result: result")
AIt prints the variable names instead of their values
BIt uses print instead of return
CIt has a syntax error in print statements
DIt logs too much information
Step-by-Step Solution
Solution:
  1. Step 1: Check how variables are used in print

    The function prints literal strings "tool" and "result" instead of variable values.
  2. Step 2: Understand correct variable usage

    To print values, variables must be inside f-strings or concatenated properly.
  3. Final Answer:

    It prints the variable names instead of their values -> Option A
  4. Quick Check:

    Variables not interpolated in strings [OK]
Quick Trick: Use f-strings to print variable values, not names [OK]
Common Mistakes:
  • Forgetting f before string
  • Using quotes around variable names
  • Thinking print must be replaced by return

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes