Skip to content
Justice Tech School

Conditions

Use if, elif and else. Each condition ends with a colon and the code inside is indented. Comparison operators are == != < > <= >=. Logic words are and, or, not.

Example
score = 72
if score >= 70:
    print("Distinction")
elif score >= 50:
    print("Pass")
else:
    print("Try again")

Result

Distinction

Exercise

Add the missing keyword.

x = 5
 x > 3:
    print("big")

Quiz Test

Which keyword means "else if" in Python?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.