Home › Python Tutorial › Python if...else
Python if...else
Make decisions.
Use if, elif and else. Remember the colon and the indentation. A one-line version is a if condition else b.
Example code
score = 72
if score >= 90:
print("A")
elif score >= 70:
print("B")
else:
print("C")
print("pass" if score >= 60 else "fail")