Python for Kids · Class 7 · Module 3 of 9

Loops and Simulations

Roll a dice six times and anything can happen. Roll it six thousand times and mathematics shows up.

8 sessionsSessions 17–24
4 weeksTypical pace
Foundation to IntermediateLevel
Class 7Python & Coding
Two dice above a bar chart of rolled totals
The big idea

Loops inside loops let programs work across rows and columns, and repeated random trials let students simulate things that would be tedious to test by hand. This is the module where code starts answering questions rather than just performing tasks.

Why it matters

Simulation connects coding directly to probability and science. Students stop guessing what is likely and start measuring it.

Unpacked

What you will actually learn

Three core ideas, each taught with worked examples and then practised until it feels obvious.

01

Nested loops

Nested loops run one loop inside another — the outer picks the row, the inner walks the columns. Grids, tables and patterns all come from this shape.

02

Counters

Counters accumulate results across a loop: total, how many times, highest so far. Initialising them in the right place is the whole trick.

03

Random simulation

Random simulation runs an experiment thousands of times and measures the outcomes. The results converge on the mathematical answer, visibly.

Did you know?

This technique is called the Monte Carlo method, named after the casino. It was invented during the 1940s to solve physics problems no equation could crack.

Common mix-up

“The dice is due for a six.” It is not, and your own simulation will prove it across ten thousand rolls.

Session by session

Your 8-session journey

Sessions 1724 of the 72-session year, at two one-hour sessions per week.

  1. 1

    Warm-up and big picture

    Where this module fits, what you will build, and a hands-on starter that gets everyone curious about nested loops.

  2. 2

    Nested loops

    Guided teaching on nested loops, worked through together with the teacher.

  3. 3

    Nested loops — practice lab

    Independent practice, small challenges and one deliberate mistake to diagnose.

  4. 4

    Counters

    Guided teaching on counters, building directly on the previous two sessions.

  5. 5

    Counters — practice lab

    Applied tasks that combine nested loops and counters in one piece of work.

  6. 6

    Random simulation

    Random simulation introduced and practised, completing the toolkit needed for the project.

  7. 7

    Project build

    Guided build session for the module project: Dice experiment.

  8. 8

    Test, present and reflect

    Finish, test against the checklist, present the work and explain the decisions behind it.

Project lab

Dice experiment

Every module ends with something the student built themselves and can demonstrate. This is the piece that goes into their portfolio and gets explained out loud at the end of session 24.

Try this at home

Simulate rolling two dice 10,000 times and count how often each total appears. Chart it and explain why 7 wins.

It is finished when

  • It works from start to finish without breaking
  • You can explain every part of it in your own words
  • You tested it and improved at least one thing afterwards
  • Someone else used or understood it without your help

By the end of this module

Students finishing Module 3 can:

  • Explain and use nested loops without prompting
  • Explain and use counters without prompting
  • Explain and use random simulation without prompting
  • Build and finish dice experiment
  • Test your own work and correct what you find
  • Talk an adult through what you made and why

Word bank

The vocabulary introduced here, in plain language:

nested loop
A loop running inside another loop.
counter
A variable that accumulates a running total.
simulation
Modelling a real process by running it many times.
Module challenge

Think you have got this?

0 XPLevel 1 · Curious Beginner

6 quick questions drawn from this module — vocabulary, the project you build, and a myth-or-fact round. Every wrong answer explains itself, so a mistake still teaches you something.

🎯 6 questions⚡ Up to 80 XP

Your child's free trial is one message away.

Tell us your child’s class and what they enjoy. We will suggest the closest program fit—no pressure and no upfront payment.