Conditions: if, elif, else
PYTHON
score = 85 if score >= 90: print("A") elif score >= 80: print("B") else: print("C or below")
The colon : ends the condition line, and the indentation (4 spaces) marks what belongs inside it. In Python, indentation is part of the language, not decoration.
PYTHON
stock = 3 reorder_level = 5 if stock == 0: print("Out of stock!") elif stock < reorder_level: print("Low stock: reorder soon") else: print("Stock OK")
Watch out
= stores and == compares. if x = 5: is an error; write if x == 5:.