Skip to content
PlayOwl

Coding worksheet · Computers & Digital Literacy

Trace the repeat blocks: what does Olly say? · Grade 4

Read 6 short block code programs about repeat loops that add up and work out by hand what each one prints or the final value of a variable. Builds careful code tracing.

  • Grade 4 · ages 9 to 10
  • Hard
  • 15 to 20 minutes
  • 1 page
  • Free
Paper

The answer key is a separate page for grown-ups. Sign in to download it.

Make another one like this

Directions: Read each program from top to bottom, one block at a time. Keep track of every box (variable) as it changes, then write the answer.

  • 1 How many acorns at the end?
  • set acorns to 3 repeat 4 times set acorns to acorns * 2
  • acorns =
  • 2 What does Olly say?
  • set total to 0 for each n in [4, 6, 1, 4] change total by n say total
  • 3 How many gems at the end?
  • set gems to 5 repeat 3 times change gems by 4
  • gems =
  • 4 How many seeds at the end?
  • set seeds to 0 set n to 1 repeat 5 times if n > 4 then change seeds by 2 change n by 1
  • seeds =
  • 5 What does Olly say?
  • set gems to 0 set seeds to 13 repeat 4 times change gems by 2 change seeds by -2 say gems, seeds

What your child practices

Your child builds careful code tracing. The skill is “Loops”: use repetition to shorten programs.

Grades and ages
Grade 4, ages 9 to 10
Time
About 15 to 20 minutes
Subject
Computers & Digital Literacy
Level
Hard for Grade 4
Answer key
Yes, for grown-ups who sign in
Printing
1 page, US Letter or A4, low-ink option
Updated

How to use it

Work through the first program together, one line or arrow at a time. Then let your child work through the rest, showing their thinking on the page. It is one of the harder sheets for Grade 4, best once the basics of the skill are secure.

An answer key comes with it as a separate page that grown-ups download after signing in.

Tip for grown-ups: Have your child write each variable's value beside its line as they trace.

Done on paper? A grown-up can record it on the child's page in PlayOwl; downloading alone doesn't count as finished.

Printable generator

Make your own printables

Make brand-new sheets like this one, with answer keys, using the printable generator that comes with a PlayOwl plan. This sheet stays free.