Bird
0
0

Find the error in this elif ladder code:

medium📝 Debug Q14 of 15
Python - Conditional Statements

Find the error in this elif ladder code:

num = 10
if num < 5:
    print("Small")
elif num > 5
    print("Big")
else:
    print("Medium")
AMissing colon after elif condition
BWrong indentation of print statements
CUsing else without condition
DUsing < instead of > in if
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of elif line

    Line 'elif num > 5' is missing a colon at the end.
  2. Step 2: Identify correct syntax for elif

    Elif condition must end with a colon ':' to be valid.
  3. Final Answer:

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

    Elif line needs colon ':' [OK]
Quick Trick: Always put colon after if/elif/else lines [OK]
Common Mistakes:
MISTAKES
  • Forgetting colon after elif
  • Misaligning indentation
  • Thinking else needs condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes