0
Conditions1 / 4

CRASH COURSE

Conditions

Programs make decisions with if statements. If the condition is True, the indented block runs.

  • Indentation matters in Python — the code inside an if must be indented (usually 4 spaces).
  • Add elif for extra checks and else for everything else. Comparisons use ==, !=, <, >, <=, >=.
score = 85

if score >= 90:
    print("Grade: A")
elif score >= 80:
    print("Grade: B")
elif score >= 70:
    print("Grade: C")
else:
    print("Keep practicing!")