CurriculumThe Dragon Decides

Python if, elif and else for Kids

An if statement lets a program do something only in certain situations, instead of doing the same thing every time.

16 exercises5 lessonsAges 10+PRO
See what PRO unlocks →

What this topic covers

Before a child can write an if statement, they need to believe that a comparison like gold > 100 is itself a value — something Python works out to True or False, the same way it works out 40 + 2. The topic starts there, with comparisons on their own, before any if appears.

Then comes if by itself: doing something when a question is True, and nothing at all when it is not. That 'and nothing at all' is deliberately given its own space, because a branch that does nothing visible is genuinely harder to reason about than one that does something.

elif and else follow, and with them the idea that the order of checks matters — a chain that tests the loosest condition first will never reach the more specific ones below it. That is the single most common source of 'my code runs but gives the wrong answer' at this level, so the closing challenge is built specifically to expose it.

Python from this topic

gold = 42
if gold > 100:
    print("Rich")
else:
    print("Not yet")

Output

Not yet

Python covered here

  • Comparison operators: >, <, >=, <=, ==, !=
  • True and False as real values
  • The if statement
  • elif for additional cases
  • else as the catch-all
  • Why the order of conditions changes the result

The mistake this topic is built to fix

Common mistakeA child believes every branch of an if/elif/else runs, one after the other, like ordinary lines of code.

This is a documented and stubborn misconception: the child reads the code top to bottom and assumes each line executes in turn. The topic uses cases where a wrong order produces a plausible-looking but wrong answer, so the mistake is visible rather than silent.

The lessons, in order

  1. Asking questions about numbersTrue or False — how the dragon tests a value before deciding anything.4 exercises
  2. if, by itselfDoing something only when a question is True — and nothing when it isn't.3 exercises
  3. elif and elseChains of decisions — and why the ORDER and the KIND of check both matter.3 exercises
  4. The Dragon CouncilJudge every dragon fairly — one title each, even the tricky ones.3 exercises
  5. Order and overlapWhy elif's ORDER can make a branch impossible to reach — and when separate ifs are the right call instead.3 exercises

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $6.99 unlocks it along with everything else.

Try it now

The very first level needs no account at all — see whether it clicks before signing up for anything.

Play the first level free →