If Elif Else
What is an If-Elif-Else statement?
Python challenge - If-Elif-Else statement
Enter the following code in a Python code editor. Before running the code, what do you think it will do?. Press "F5" then "Enter" to run
The first line asks a user to enter an integer to answer the question. This number is then held within the variable called "litter". This value is then compared to the numbers pre-defined numbers in the "if" and "Elif" statements. If the number meets a condition, then that branch of the code is executed.
In the example code above, two different relational operators are used, == and <=. Below is a list of relational operators that can be used in your code