Bird
0
0

Identify the error in this human approval workflow code snippet:

medium📝 Debug Q14 of 15
Agentic AI - Agent Safety and Guardrails
Identify the error in this human approval workflow code snippet:
def check_approval(confidence):
    if confidence < 0.7
        return 'Request approval'
    else:
        return 'Auto approve'
AFunction missing return statement
BWrong comparison operator
CIndentation error in else block
DMissing colon after if statement
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of if statement

    The if statement is missing a colon (:) at the end, which is required in Python syntax.
  2. Step 2: Verify other parts of the code

    The comparison operator is correct, indentation looks fine, and return statements are present.
  3. Final Answer:

    Missing colon after if statement -> Option D
  4. Quick Check:

    Python if needs colon [:] [OK]
Quick Trick: Check for colons after if/else statements [OK]
Common Mistakes:
  • Ignoring missing colon syntax error
  • Thinking indentation is wrong
  • Assuming return statements are missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes