Sort the function calls

Report a typo

Let's go back to our function for finding the factorial:

def recursive_factorial(n):
    # negative numbers have no factorials
    if n < 0:
        print("no solution")
    # base case
    elif n == 0:
        return 1
    # recursive case
    else:
        return n * recursive_factorial(n - 1)

In the situation when the function is asked to compute 4!4!

recursive_factorial(4)

what would be the order of the function calls?

Put the items in the correct order
recursive_factorial(1)
recursive_factorial(3)
recursive_factorial(4)
recursive_factorial(2)
recursive_factorial(0)
___

Create a free account to access the full topic