Activity 01
Pair Debug: Nested Loop Tracers
Provide pairs with pseudocode containing a logical error in nested loops. Students construct trace tables, predict outputs, run manual simulations, and propose fixes. Pairs then swap code with another pair to verify solutions.
How can we systematically isolate a logical error in a complex nested loop?
Facilitation TipDuring Pair Debug, insist students alternate roles every two minutes to keep both partners actively tracing rather than one dominating the keyboard.
What to look forProvide students with a small, buggy Python script containing a nested loop. Ask them to create a trace table for the script and identify the line number and the specific error causing the incorrect output. 'Trace the execution of this script. What is the value of variable X on line 15? What is the final output, and why is it incorrect?'