0 XP
Chapter 5
If / Else Decisions
Make your game react to different situations.
Core Concept
Conditionals let your game decide what to do based on what's happening.
Theory
health = 20
if health <= 0:
print("You died!")
elif health < 30:
print("⚠️ Low health! Find a potion!")
else:
print("You're doing great!")
Comparison operators:
== != < > <= >=
Logical: and or not
Live Demo — Run & Explore
Try it live
Loading...
Output will appear here…
Exercise 1 / 1
📝 Write an `if/elif/else` that prints 'Boss!' if score > 1000, 'Good!' if score > 500, else 'Keep going!'
Your solution
Loading...
Output will appear here…
Ask AI Tutor
AI Tutorgemini-3.1-flash-lite-preview
AI
Hi! I'm your AI tutor for If / Else Decisions. 🎓
Ask me anything about this lesson — what a variable is, why loops are useful, or "why is my code not working?". I'm here to help you understand, not just give you answers!
What's on your mind? 😊