- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
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.
Sample question
Question 1 of 10What 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,elifandelsepick exactly one branch - Why the order of
elifconditions 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.