CodeAgeBy Sitezack
Python for Builders — Level 3Decisions and repetitions0 XP
Chapter progress0/6

Lesson 3 of 7

elif: more than two choices

When there are more than two cases, elif ("else if") tests another condition after the if.

Python reads top to bottom and stops at the first true condition — order matters!

points = 75
if points >= 90:
    print("gold")
elif points >= 60:
    print("silver")
else:
    print("bronze")

🎯 Your mission

You finished the race in time = 42 seconds. Award stars: stars = 3 if time < 30, stars = 2 if time < 60, otherwise stars = 1. Print stars.

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO