CurriculumHow Python Runs Your Code, for KidsOne line at a time

Python Runs Top to Bottom, One Line at a Time

The assistant reads your code top to bottom — nothing skips, nothing jumps ahead.

Lesson 1 of 4FreeAges 10+
Try this lesson interactively →

One line at a time

Before you meet the dragon, meet the one who actually reads your code: the assistant.

The assistant reads exactly like you'd read a letter — top line first, then the next, then the next.

print("First")
print("Second")
print("Third")

Output

First
Second
Third

It never skips a line, never jumps ahead to a line it likes better, and never guesses what you probably meant.

If you write two lines in the wrong order, the assistant still reads them in the order YOU wrote — even if that looks silly.

print("Goodbye")
print("Hello")

Output

Goodbye
Hello

So the order you type your lines in is the order things happen. Always.

Check your understanding

Which order does the assistant read these in?

print("A")
print("B")
print("C")
  • A, then B, then C — top to bottom
  • Whichever order makes the most sense
  • All three at the same time

Why: A, then B, then C — always top to bottom, one line completely finished before the next one starts.

print("Goodbye") is written BEFORE print("Hello") here. What happens?

print("Goodbye")
print("Hello")
  • It says "Goodbye" first, then "Hello" — exactly as written
  • The assistant fixes the order, since Hello should come first

Why: It says exactly what you wrote, in the order you wrote it: "Goodbye" then "Hello" — even though that reads oddly to us.

What you'll practice

The dragon's assistant reads your code exactly like a letter — top line first, then the next, then the next. Nothing gets skipped, nothing jumps ahead. Write three lines that print ONE, TWO, THREE — in that order.

Start this lesson for real →

More from this topic

One line at a time is one lesson inside How Python Runs Your Code, for Kids — see the full lesson order and what the whole topic covers.

View the full topic →