Activity 01
Pair Coding: Factorial Recursion
Pairs write a recursive factorial function in Python, including a base case for n=0 or 1. They test with inputs from 1 to 10, printing each recursive call. Discuss outputs and modify to return values only.
How do you determine if a problem is better solved through recursion or iteration?
Facilitation TipDuring Pair Coding: Factorial Recursion, circulate and ask pairs to explain their recursive step aloud before coding it to surface misconceptions early.
What to look forPresent students with a pseudocode snippet of a recursive function (e.g., factorial). Ask them to identify the base case and the recursive step, and explain what would happen if the base case were removed.