Activity 01
Pair Programming: Error Handler Challenge
Pairs receive a vulnerable function processing user inputs. They add input validation and try-except blocks to handle exceptions gracefully. Test with edge cases like empty strings or invalid numbers, then swap code for peer review.
Explain the importance of proper error handling in preventing system vulnerabilities.
Facilitation TipDuring Pair Programming: Error Handler Challenge, circulate and ask pairs to explain their error handling choices before they run the code, forcing them to justify their defensive strategies.
What to look forPresent students with short Python code snippets containing common errors (e.g., division by zero, file not found). Ask them to write the try-except block needed to handle each specific error gracefully and print a user-friendly message.