I'm trying to get the function input to be similar to
RangeFactorial(10)
and the function produce the factorials of each number from 0 to 10
Currently I have:
def RangeFactorial(n)
result = 1
for x in range(1, n +1):
result = result * x
return result
for n in range(1, 10):
print(n, RangeFactorial(n))
The outcome is fine, but I would the range input be like I stated above.
Additionally, I want the output to be a list and I've no idea where to start with that.
The function you call
RangeFactorialis just the regular factorial function:RangeFactorialwould be the function that callsfactorial10 times:To build a list instead of printing the values, you can do, for example,