Technology • Python
Python Basics: Control Statements
Control statements alter the flow of program execution in any language. Here, we shall be exploring the if-elif-else structure. Syntax: if : your code.. elif : your code... else : your code... View embedded content at…

Control statements alter the flow of program execution in any language.
Here, we shall be exploring the if-elif-else structure.
Syntax:
if :
your code..
elif :
your code...
else :
your code...
View embedded content at its source
Using the match statement
The match statement is used when there are multiple cases and need to be made more readable and maintainable.
Case _: indicates the default case / else case. This case will execute when none of the other cases are matching the condition
Syntax:
match
case :
your code ...
case :
your code ...
case _:
your code for else case
Example:
View embedded content at its source
Originally published on Inspire Innovative Learning.
View the original article