The big little idea
An if statement lets a program choose. If its condition is True, it runs the indented instructions. Otherwise, an else block can do something different.
weather = "rainy"
if weather == "rainy":
print("Pack a raincoat!")
else:
print("Grab your sun hat!")Use == to compare values and = to assign them. Other comparisons include > (greater than), < (less than), and >= (at least). The colon and indentation tell Python which instructions belong to each choice.