start with n =
−
4
+
← Back
Step →
Reset
code
def factorial(n):
if n <= 1:
return 1
return n * factorial(n - 1)
call stack (newest on top)
Each call adds a frame on top; each return removes the top frame and hands a value down to the frame below.