CHAPTER 19 •
PYTHON
Python Elif
Learn how to check multiple conditions.
01 What is this?
Learn how to check multiple conditions.
02 Syntax
Python Syntax
if condition: elif condition: else:
03 Example
Python Example
marks = 75
if marks >= 90:
print('A+')
elif marks >= 60:
print('B')
else:
print('C')
04 Important Points
Elif allows multiple conditions to be tested.
05 Common Mistakes
Put conditions in the correct order.
06 Real World Use
Elif is useful for grades, categories and menu systems.
07 Practice This Topic
Now try the example yourself in the AIFA Python Editor.
- Read the example carefully.
- Change the values.
- Run the code.
- Observe the output.
- Try creating your own example.