At first it seemed liked multiadder needed two inputs for this to work, but the answer is quite straightforward. I wouldn't think an "Introduction to Python" class would need lamba functions and so on.
This is final answer:
def multiadder(n):
assert n > 0
if n == 1:
return 1
else:
return n + multiadder(n - 1)
The graph below explains how it works for n = 4:
multiadder(4)
|
return 4 + multiadder(3)
|
return 3 + multiadder(2)
|
return 2 + multiadder(1)
|
return 1
So the final result for n = 4 ends up being 4 + 3 + 2 + 1 = 10.