Got no idea why it works


#1

I tried this one which I think respects very litteraly the hints they give you. Got no idea why it works but it does :)

def factorial(x):
   while x > 0:
        if x > 1:
            return x * factorial(x - 1)
        else:
            return 1

5/15 Factorial
#2

You have something in there that does nothing useful that can be removed. How many times does your loop iterate? What happens after returning?

Executing it manually will show you what it does, pick a low number and see what happens.