2.4.1.1 if Statement
Python Programming
The if statement lets us make decisions based on conditions. If the condition is true, it runs a block of code.
python
# Syntax of if statement if condition:
if condition:
# code to run if the condition is trueExample: If the temperature is above 30 degrees, we print a message.
python
temperature = 35
if temperature > 30:
print("It’s a hot day")