0
i thought out of the box and created a program to calculate factorial(which doesnt use recursion)
plz tell me why isnt this working https://code.sololearn.com/ch75cyRHMRvw/?ref=app
2 Answers
+ 4
Put
result = 1
Before the loop outside.
+ 3
Remove result=1 from the loop
f_no = int(input("give the no to take factorial of "))
multiples = list(range(2, f_no + 1))
result = 1
for i in range(f_no-1):
result = result*multiples[i]
print(result)