In python course:
Lesson: 'Practice Makes Perfect' / exercise 5. factorial
When i try the code below it finds the correct result but i get the warning:
'Ops, try again. factorial(1) returned None, did you remember to return the result?'
def factorial(x): a= result=1 for i in range(x+1): a.append(i) a.pop(0) print a for item in a: result*=item print result factorial(0)
factorial(0) returns 1,
factorial(1) returns 1,
factorial(5) returns 120
So, i would like to know where i am failing. Many thanks for the help in advance.