Skip to content
← Python for AI/ML · all 50 levels

elif

Level 13 of 50 · Decisions & loops

Level 13 of 50

elif

explained with exam results. Watch the reel, then work through it below: run the code, take the quiz, keep the cheat sheet.

📒 Open the cheat sheet
SanaResult day! Ayesha got 82. So what grade is that?
TeacherA, B or C? More than two choices! In Python, that's elif!
grade.py
marks = 82

if marks >= 90:
    print("A")
elif marks >= 80:
    print("B")
else:
    print("C")
TeacherPython checks top to bottom. The first True condition wins!
SanaWait, how many elifs can I add?
TeacherAs many as you want! But only ONE block ever runs!

⏸ Pause & predict: what prints?

temp = 38

if temp > 30:
    print("Hot")
elif temp > 35:
    print("Very hot")
else:
    print("Nice")
Next: Nested if →← if / else

Where this leads

Python is step one. Building AI that ships is the rest.

The diploma takes you from zero to deployed computer vision, LLM and agent projects, with engineers who build them for a living. Already code? The bootcamp does it in three months.