# basics conditionals

if / elif / else

When you have more than two options, add elif (short for "else if") between if and else. Python checks each one top to bottom and runs the first one that matches:

score = 85
if score >= 90:
    print("A")
elif score >= 80:
    print("B")
else:
    print("C")

prints B, since 85 isn't >= 90 but is >= 80.

Your turn: read a number score. Print A if score >= 90, B if score >= 80, C if score >= 70, otherwise print F.

💡 need a hint?

pyb-cond-if-elif-else.py🔒 given lines are locked — write your code in between
loading...