Python Functions, Parameters and return for Kids

A function lets you name a piece of code once and run it again as many times as you like.

  • 15 exercises
  • 5 lessons
  • Ages 10+
  • PRO

This topic is part of PRO — a one-time $49.99 purchase, no subscription. Topics 1–3 are free, start to finish, and the first level needs no account.

For parents & teachers

What this topic covers

Functions start simply: def names a group of code, and nothing happens until that name is actually called — a distinction children need stated directly, since a common misreading treats defining a function as running it. Parameters follow immediately after, framed as customising an ability rather than as abstract 'inputs', since the same function producing a different result each time it's called is the whole point.

The hardest idea in this topic, and the reason it is sequenced this late, is return. Research on introductory programming finds the confusion between return and print persistently resistant to direct teaching, and it is worse here than in most curricula, because print() has been the mechanism by which the game world visibly reacts since the very first topic — so 'make something happen' and 'print' fuse early and hold on tight.

This topic gives return a genuinely separate, visible destination rather than asking children to take the distinction on faith: a function that returns a value hands it to a real second channel, distinct from anything print() can do, so the difference between showing a value and handing one back is something a child can see rather than something they're told.

Built around a real misconception

The mistake this topic is built to fix

Common mistake

A child believes a returned value is automatically shown, the same way a printed value is, or that calling a function jumps away and never comes back.

Why the topic is built around it

Documented as resistant to direct instruction, and made worse by a game whose core mechanism up to this point has been print() as the world's reaction. This topic gives return its own real destination so the difference is visible on screen rather than asserted in prose.

functions.pyPython 3
def compute_damage():    return 10deliver(compute_damage())
Output10 delivered

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. Write it once, call it as many times as you like — no retyping.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  2. Fireball, but bigger — the same function, a different result each time you call it.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  3. return doesn't print anything — deliver() is where a returned value actually goes.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  4. print() shows it, deliver() sends it — choosing the right channel for each function.

    • Explain
    • Ask
    • Guided 1 level
    • Challenge 2 levels
  5. A function can change your list forever — but a number is safe no matter what happens inside.

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

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $49.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