Lazo Lab Sign up

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!")
Watch a video on thisOpens YouTube search results for “if statements” in a new tab

Quiz · +10 XP

What must come at the end of an if line?

Log in to save progress and earn XP.