Module 2 - Section 1 - Controlling the flow
Module 2 - Section 1 - Controlling the flow
- create code using the if statement
- recognize and use indented blocks of code
- solve Boolean algebra logic problems
- create code using the complicated if statements with elif and else
- recognize nested if statements and use them
2.1.6 - Multiple cases in IF
What is and inside the if command? and means that in order for the statement to be true both statements should be true. Copy the following code and save it as check_up.py inside your working folder.
What is or inside the if command? or means that in order for the statement to be true one or both statements should be true. Copy the following code and save it as friend.py inside your working folder.
In the programs above think which are the variables and what type are these variables.
We have now a new problem for you.
We want to create a program that asks for three numbers and then displays the greatest.
As an example when we execute the program the output could be :
Hello! Please insert three different integer numbers and i will find the greatest.
The first number is : 13
The second number is : 19
The third number is : 8
Great! The greatest number of 13,19,8 is 19.
You can find a solution here