2.1.7 - If inside an if = nested if?

Sometimes we want to check a condition inside another condition. 

If we want to issue a forecast for temperature and humidity we can write the simple code below. 

In order for the second condition (humidity) to be examined the first (temperature > 30) must be true. 

Copy and paste the following code to Thonny. You can view the steps of execution using the Debug button.

Thonny Debug Button

print ("This is my weather forecast") tempr = int(input("Please insert the Temperature in Celsius : ")) hum = int(input("Please insert the Humidity of the air : ")) if tempr > 30: if hum > 80: print ("It's hot and humid") else: print ("It's hot but not humid") else: print ("It's not hot")