Challenge: Nested-Loop Patterns
Thinking It Through · nested loops · reason about a loop inside a loop

Kavi and the Stadium of Lights
Kavi looked up at a huge scoreboard made of tiny lights — 8 rows, with 10 lights in each row. "How many lights is that?" a young owl asked. Kavi smiled and pointed at a short program on the wall: Repeat 8 times [ Repeat 10 times: switch on a light ]. "Count them one by one and you will be here all night," Kavi hooted. "But a nested loop does the thinking: the inner loop lights up all 10 in a row, and the outer loop does that for each of the 8 rows. So you don't add — you multiply: 8 × 10 = 80 lights." Kavi's eyes sparkled. "The real challenge isn't lighting them up — it's being able to reason about any loop inside a loop: how many, how deep, and what runs most."
What your child will learn
A peek inside
Try this at home: In a nested loop, to find how many times the body runs you ____ the two repeat counts.
Ready to play and learn?
Start the free interactive lesson, or print the handout for screen-free play.
Part of Computing · Stage 5 · S5 on KAVI Academy — a secular, whole-child learning platform for ages 5–12.
