How Python Runs Your Code, for Kids

A program runs one line at a time, in the order it was written, and does nothing you didn't actually tell it to do.

  • 12 exercises
  • 4 lessons
  • Ages 10+
  • Free

For parents & teachers

What this topic covers

Most beginner courses start with syntax and assume the child already understands how a program runs at all — that lines execute one at a time, in order, and that nothing happens unless it was written down. Research on children learning to program finds that assumption is wrong more often than not: statement sequentiality is among the most prevalent misconceptions documented in this age band, ahead of almost any specific syntax confusion.

This topic exists to fix that before any real syntax is taught. Children see code whose lines run visibly top to bottom, discover that nothing is filled in for them even when the gap looks obvious, and see that a change made on one line is invisible to every line that ran before it and permanent for every line after.

It closes with a longer sequence combining all three ideas — order, no implicit behaviour, and forward-only visibility of change — using nothing but printed text, so the concept stands completely on its own before Python's real syntax arrives in the next topic.

Built around a real misconception

The mistake this topic is built to fix

Common mistake

A child assumes the program will fill in an obvious missing step, or reorder lines to make more sense.

Why the topic is built around it

Documented as the 'superbug' by Pea (1986): a concealed belief that the interpreter has intelligent interpretive powers and can guess intent. A friendly, character-driven game risks reinforcing this belief rather than correcting it, so this topic deliberately keeps its examples strictly literal.

execution-order.pyPython 3
print("FIRST")print("LAST")
OutputFIRST LAST

Explain · Ask · Guided · Practice

The lessons, in order

Each lesson explains one idea in short steps, checks it landed with a question, walks through a guided first try, then leaves the child to practise on their own.

  1. The dragon does your code top to bottom — one line, one step, nothing skipped.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  2. No guessing, no auto-repeating, no picking things up by walking over them — only what's written.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  3. A change made on one line is real for every line after it, and invisible to every line before it.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  4. Order, no gaps, no auto-repeats, changes only forward — everything at once.

    • Explain
    • Ask
    • Guided 1 level
    • Challenge 2 levels

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is free, start to finish.

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