2.1.5 - If and more If - Else if? or Else?

When we want to make a decision and from the outcome of the decision act then we use the if command. 

if

Copy and paste the following code to the Thonny's editor and save it as temperature_decision.py inside your working folder.


As you can see inside the code there are three cases. One when temperature is greater than 30, one when temperature is lower than 12 and one in every other case. 

Try the code using different temperature more than 30, between 12 and 30 and less than 12.

In the previous code , the program will output “It is hot outside” even if the user types in 70 degrees. Why? How can the code be fixed?

If you want to see a solution click here.