Control Flow · Lesson 33 of 76

If statements

if runs code only when a condition is true. elif and else cover the other cases:

Python

The indentation (the spaces) is how Python knows what belongs inside the if — keep it consistent.

Your turn: change score, re-run, and watch which branch prints.

Check your understanding

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →

Lesson 33 of 76