The maker space is quiet on Saturday. Comet has written a six-line program on a large sheet of paper.
"No screens today," she says. "One person reads the program aloud. The other one is the computer and fills in the trace table."
Wren rules neat columns on a fresh page of graph paper. "What does the evidence say?" he asks. "If two people trace the same program, they should get the same table."
Nova dims her lights to a soft glow. "How can I help?" she asks. "Read slowly. The computer only does exactly what each line says."
Comet passes you the sheet. "Find a family member, lead programmer. You are the computer first."
Here are the two programs for the game. Each one runs in Python just as shown, so you can check your table at the computer afterwards.
# be_the_computer.py
battery = 100
steps = 0
while battery > 80:
battery = battery - 5
steps = steps + 1
print(steps, battery) # be_the_computer_2.py
total = 0
for n in range(1, 5):
total = total + n
print(n, total)
print("done") | Line read aloud | battery | steps |
|---|---|---|
| battery = 100 | ||
| steps = 0 | ||
| (keep adding rows) |
| Statement | True or false? |
|---|---|
| Two careful tracers of the same program get the same trace table. | ? |
| print("done") in be_the_computer_2.py runs 4 times. | ? |
You were the computer today. Next week the crew turns Comet's dicts into real objects with a class.