Oops, try again. factorial(1) returned None, did you remember to return the result?
I am stuck at my current code because I think it would be okay when input is positive integer. However, it couldn't run at all.
The other question is that sometimes I will feel confuse about the where should I return the value in the program. Inside the for loop or outside of it ? I hope someone can explain the reason that why should I put return code in this position .
def factorial(x): num = 1 for s in range(x-1): num = num*(s+1) return num print factorial(4)