+ 1

I want to print array of factorial of a number.Why my program is showing error?

def factorial(n): fact = [1] for i in range(1,n+1): return fact.append(fact[(i-1)]*i) n = input() print (factorial(n))

12th Sep 2018, 10:56 AM
Karan Kapoor
Karan Kapoor - avatar
2 Respuestas
+ 1
Mainly your function is factorial, not fact. Search for recursivity, see examples and try solving again
12th Sep 2018, 11:11 AM
Alexander Santos
Alexander Santos - avatar
0
Don't use so many tags please. 3-5 tags are optimal.
12th Sep 2018, 12:31 PM
Jan Štěch
Jan Štěch - avatar