If, elif and else
If, elif and else
if evaluates a condition and runs an indented block when it is true. elif checks another condition and else handles the remaining case. Python treats empty collections, zero and None as false-like values.
Try it yourself
Change the example, run it, and explain the result in your own words. Then create one variation of your own.
Key idea
Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.
Code example
score = 72
if score >= 70:
print("Excellent")
elif score >= 50:
print("Pass")
else:
print("Try again")