Exam-style question
Try this first
What is the result of this Python function call? ```python def f(n): if n == 0: return 0 return n + f(n - 1) f(3) ```.
- A.3
- B.5
- C.6
- D.9
Model answer
What a good answer should say
- 6
Explanation
Why this works
The calls produce 3 + f(2), then 2 + f(1), then 1 + f(0). The base case returns 0, giving 3 + 2 + 1 + 0 = 6.
Common mistake
No common mistake is linked to this question yet.
