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…

Lists
Your First Window