Activity 01
Pair Programming: Scope Error Hunt
Provide pairs with Python code containing mixed scope errors. They run the code, predict variable values at key points, then fix issues by declaring locals or using 'global'. Pairs test fixes and explain changes to another pair.
Differentiate between local and global variables in Python.
Facilitation TipIn Pair Programming: Scope Error Hunt, circulate and listen for pairs explaining why a NameError appeared, nudging them to connect the error to scope rules.
What to look forPresent students with three short Python code snippets, each demonstrating a different scope scenario (e.g., accessing a global, modifying a global without 'global', defining a local). Ask students to predict the output and explain their reasoning for each snippet.