Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q13 of 15
Python - Conditional Statements
What will be the output of this code?
age = 20
if age < 18:
    print("Child")
elif age < 65:
    print("Adult")
else:
    print("Senior")
AAdult
BSenior
CChild
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Check the value of age

    The variable age is 20.
  2. Step 2: Evaluate conditions in order

    First condition age < 18 is false (20 is not less than 18). Second condition age < 65 is true (20 is less than 65), so it prints "Adult" and skips the else.
  3. Final Answer:

    Adult -> Option A
  4. Quick Check:

    20 is less than 65, prints Adult [OK]
Quick Trick: Check conditions top to bottom; first true runs [OK]
Common Mistakes:
MISTAKES
  • Printing Child for age 20
  • Ignoring elif and jumping to else
  • Thinking no output if first condition false

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes