-
if is the program evaluates the test expression and will execute statement(s) only if the test expression is True.
-
If the test expression is False, the statement(s) is not executed.
- Else statement is to evaluate a condition and take one path if it is true but specify an alternative path if it is not.
- Use the elif condition is used to include multiple conditional expressions after the if condition or between the if and else conditions.
- The elif is short for else if. It allows us to check for multiple expressions.
- If the condition for if is False, it checks the condition of the next elif block and so on.
- If all the conditions are False, the body of else is executed.