+ 1
Find out the error
n=input("Enter the number") fact = 1 for i in range(1,int(n)): fact = fact * i print(fact) Output: Enter the number5 24 Expected output: 120
1 Answer
+ 4
range(1, n) doesn't include n. It's from 1 to n-1. So you need to change it to range(1, n+1).