Skip to the content
Peabody TeachFor teachers and grown-ups

🔍 Read It, Run It, Say It v0.1.0

Students trace three short programs by hand (a loop in a loop, a named recipe, a list) and then say in their own words what each one does. Reading code and explaining it is now worth more than typing it.

  • For: 6th to 8th
  • Time: about 45 minutes
  • The question: Can you read a program and know what it will do before it runs?
  • CSTA (2017): 2-AP-12, 2-AP-14

You will need

  • The printable's three programs and trace table
  • Pencils
  • A screen at the front for the last step, or nothing if you use the paper version

The lesson, step by step

  1. Say how to read it

    Tell the class that reading a program means being the computer: go top to bottom, one line at a time, and keep a note of what each line changes. You never skip a line and you never guess. A trace table is the note.

  2. Trace the loop in a loop

    Do program 1 together. Write a column for the outer repeat and a column for the inner one, and fill in what it says each time round. Students often add the counts (3 plus 2) instead of multiplying (3 times 2). The table shows them why it is multiplied.

  3. Trace the recipe

    Program 2 has a named recipe. Say that defining the recipe says nothing at all; each do line runs it. Ask students to circle each do and write what comes out under it. A recipe is a way to name a chunk of steps so you can use it again without rewriting it.

  4. Trace the list

    Program 3 goes through a list and adds some of the numbers. Students write the list, then for each item write whether it passes the if, and the running total. Ask them to predict the total before they trace it, then compare.

  5. Say it in your own words

    Each student writes one plain sentence for each program, as if telling a friend what it is for, not what each line does. "It counts up the numbers over 3" is better than "it sets total to 0". This is the skill of explaining code.

  6. Now ask the AI

    Use the box below. Whatever the AI says, the students' traces are the judge.

Questions to ask while they work

  • What does line 1 change?
  • How many times does the inside run in all?
  • Where does the recipe run?
  • Say it in a sentence a friend would get.

Now ask the AI

Show program 3 on the screen. Before you ask, each student writes their own answer. The teacher types, at the front, on a screen everyone can see. Use an AI tool your school allows. No name, school or personal detail goes into the box, ever.

What to send:

Here is a short program in plain steps. Say what it does, one line at a time, and tell me exactly what it says at the end. Do not skip a line. [paste program 3]

What to check in what comes back:

  • Did it get the same final answer as your trace?
  • Did it describe every line, or skip one?
  • Did it say a number that your trace shows is wrong? Which line did it misread?
  • Is its explanation clearer or less clear than yours?

Write it down: Write two sentences: one thing the AI explained well, and one thing it got wrong or left out, with the line number.

No AI today? Do it on paper: Be the explainer

The same step, with people and paper, for when an AI is resting, not allowed at your school, or not what you want in the room.

  1. Work in threes: a reader, an explainer and a judge.
  2. The explainer reads program 3 line by line aloud in plain words, as the AI would, with the program in hand and the answer hidden.
  3. The judge has their own trace table and says "match" or "stop" at the first line where the explanation and the trace differ.
  4. Swap jobs and do program 1 or 2. Write the same two sentences.

If it goes fast

  • Change one number in a program and predict the new answer before tracing it.
  • Write a recipe of your own, then a program that uses it three times.
  • Find two programs that look different but do the same thing.

The printable

One sheet each. The key for the teacher is in the answer line under each program. Students write their own trace before they look.

Teacher key (not on the printable)

  • Program 1 really says: star, star, line, star, star, line, star, star, line
  • Program 2 really says: clap, stomp, clap, stomp, clap, stomp, hop
  • Program 3 really says: 20

◂ Break It into Parts, Then Break It on Purpose · All ten lessons · Say It So Exactly That a Machine Gets It ▸

Nothing on this page is sent to us. The printable has a blank name line and no child's details. No sign-in, no ads.