Bird
0
0

You wrote this alert rule:

medium📝 Troubleshoot Q6 of 15
Rest API - API Testing and Monitoring
You wrote this alert rule:
if response_time > 2
    send_alert()

Why does this cause an error?
AMissing colon after if condition
Bsend_alert() is not a valid function
Cresponse_time should be a string
DIndentation is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of the if statement

    Python requires a colon ':' at the end of the if condition line.
  2. Step 2: Identify the missing syntax element causing error

    The code lacks the colon after 'if response_time > 2', causing a syntax error.
  3. Final Answer:

    Missing colon after if condition -> Option A
  4. Quick Check:

    Python if needs colon ':' [OK]
Quick Trick: If statements must end with a colon ':' [OK]
Common Mistakes:
MISTAKES
  • Omitting colon after if
  • Assuming function name is invalid
  • Wrong indentation blamed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes