Activity 01
Pair Programming: Loop Efficiency Race
Pairs write a program to sum numbers from 1 to 100 using both for and while loops, then time each with a stopwatch. They modify inputs to test efficiency and discuss results. Share findings with the class via a shared document.
Compare the efficiency of a 'for' loop versus a 'while' loop for a specific task.
Facilitation TipDuring Loop Efficiency Race, remind students to print variables at each iteration to visualize when and why one loop finishes faster than the other.
What to look forPresent students with a short pseudocode snippet containing a 'for' loop and a 'while' loop performing similar tasks. Ask them to write down which loop they predict will be more efficient and why, based on the number of iterations.