Activity 01
Pair Programming: Basic Loop Challenges
Pairs write a 'for' loop to print numbers 1-20 with a message. Next, code a 'while' loop for a simple guessing game where the program counts attempts until correct. Partners alternate coding and testing, then explain their code to each other.
Design a program that uses a loop to iterate through a sequence.
Facilitation TipDuring Pair Programming: Basic Loop Challenges, circulate and ask each pair to orally explain their loop’s exit condition before they run the code.
What to look forProvide students with two short code snippets, one using a 'for' loop and one using a 'while' loop, each designed to perform a similar task (e.g., printing numbers). Ask students to write one sentence explaining which loop is more appropriate for the task and why.