Python Fundamentals / Making decisions
Lesson 12 of 38
if statements
An if statement runs a block of code only when its condition is True. The block is indented by four spaces.
Key points
- End the if line with a colon
- Indent the block
- Indentation matters in Python
score = 80
if score >= 50:
print("You passed!")Quiz · +10 XP
What must come at the end of an if line?
Log in to save progress and earn XP.