Loops · Program Tracing
Read — build a mental model
L2 Comprehension
Relations
~3 min
Running total over three numbers
What is printed when this program finishes?
total = 0
for n in [2, 4, 6]:
total = total + n
print(total)
Why this activity was chosen
- Bloom level: L2 Comprehension: Predict output by simulating execution.
- Block Model level: Relations (step 3 of 4): how parts of the program affect each other: variable updates, function calls, data flow and control flow.
- Misconception targeted: shown after you answer, so it does not give the answer away.
Tracing builds an operational mental model: what is true after each statement. Distractors are drawn from documented novice misconceptions rather than random wrong answers.
AI’s role here: AI may ask the student to fill a trace table. It must not emit the final output on demand.