Python If Else Quiz

This Python if-else quiz tests how conditions and comparisons decide which block runs. It is a good fit for beginners who want to make sure they read if, elif and else the way Python does.

Easy 10 questions ~5 minutes Pass at 80% Python 3.12

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

x = 15
if x > 10:
    print("big")
elif x > 5:
    print("medium")
else:
    print("small")
Show the answer

A. big Python checks the conditions from the top and runs only the first one that is true. x > 5 is also true, but elif is skipped once x > 10 has matched.

What this quiz covers

  • How if, elif and else pick exactly one branch
  • Why the order of elif conditions matters
  • Truthy and falsy values like empty lists
  • Chained comparisons such as 1 < x < 10
  • The one-line conditional expression

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Which Python version?

Python 3.12. Every question about output was checked by running the code.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.