So, i have this question and i dont seem to figure it out. What am i doing wrong?
this is the question:
Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) with the corresponding number. Remember that the factorial of a number is defined as the product of an integer and all integers before it. For example, the factorial of five (5!) is equal to 12345=120. Also recall that the factorial of zero (0!) is equal to 1.
and this is my code:
def factorial(n): result = 1 for x in range(result,n): result = result * n+1 return result for n in range(1,10): print(n, factorial(n-1))
the original code:
def factorial(n): result = 1 for x in range(1,___): result = ___ * ___ return ___ for n in range(___,___): print(n, factorial(n+___))
and this is the error message i get:
Not quite. Pay attention to the operations that the code is
doing and make sure that the factorial function returns the
product of the numbers between 1 and n (including n).
I am stuck and my head hurts. i am sure it is a simple answer, but i can not see it. Can anyone help, please?