Module 3: Control Flow - Conditional Execution and Loops
The `if-else` and `elif` statements
-
if-else
: Provides an alternative block of code to execute if theif
condition isFalse
. `if condition:code if True
else:
code if False`
-
elif
(else if): Allows you to check multiple conditions in sequence. `if condition1:code if condition1 is True
elif condition2:
code if condition1 is False and condition2 is True
else:
code if all preceding conditions are False`