I managed to solve it with the following code:
def factorial(x): fact = 1 for n in range(x): n += 1 fact *= n print fact return fact factorial(4)
Now, I could move on. But I feel like this is not the optimal solution and also I'm curious as to what they mean in the hint:
Consider having factorial() call itself. When the input is 1, your function could just return 1. Otherwise, it could return the number multiplied by factorial(n - 1).
Note that mathematically, factorial(0) is 1.
Do they mean I should call factorial() within the factorial function? Does anybody understand the hint?