ans = -1
while ans < 0:
    N = eval(input('Please enter a positive integer: '))
if N.isdigit() == True:
    n = int(N)
if n >= 0:
    ans = n
for x in range(n - 1, 1, -1):
    ans *= x
print(ans)
Factorial calculation using Python