Be Globally Certified In Python

Python is a great text coding programming language for kids!

if elif Statement

if elif statement is used to run multiple conditions in python. 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.

What’s an if elif statement:

Like the if else statement, and elif statements can be added to an if conditional statement in python to run multiple conditions in python

Example: When going to school you can check:

(Condition) if school bus is outside:

(Decision): Get in the bus

(Alternative) elif bus is close by (means if school bus is not around, check this condition if school bus is close by):

(Decision): Walk towards bus

(Alternative) elif bus is honking (means if school bus is not around and school bus is not close by, check this condition if you can hear school bus honking):

(Decision): Wait a bit


(Decision): Go back inside

So this means when you check and the school bus is outside then you should hop in but if you can’t find bus yet, but you can see it close by then you can walk towards it, but if you can’t see school bus but hear it’s honk, then wait for it. If all conditions are not true, then go back inside

Things to note:

1. Single equal sign = is used in python to assign a variable to it’s data value

english = 70

maths = 85

2. Double equal sign == is used in python to compare if two variables have the same data

if (maths == english)

3. The column : is used to start indentation after the if else conditional statement

if (nathan == 12):

4. Indentations are the spaces inside your conditions (if, else) to tell python the statements only runs if the condition is True

if (nathan == 12):
print”Nathan is ready for the python exam” (There is a space before the print, python knows it only runs if the condition is True)