5/15 how is does it work?


#1

Why is it correct? I don't get how it works, can someone explain it to me please?

def factorial(x):
if x == 1:
return 1
elif x == 0:
return 1
return x* factorial(x-1)


#2

Probably best if you just try to execute the code in your head. Try a low number, see what happens.

Also make sure that any code that you post is intact