Quest Ladder Community — TeachForge.ai · Browse all question types
Predicting the output of a recursive function
- computing
- intermediate
- 14-16
Students read a short recursive Python function and say exactly what it prints. Three algorithms appear — factorial, powers of two and triangular numbers — each with a different base case, so the base case cannot be learned by rote.
Sample question
Read this Python program, which computes **factorial**. What exactly does it print?