while True:
    N = eval(input('Please input factorial you would like to calculate: '))
try:
    N = int(N)
except ValueError:
    print('Invalid input: not an integer.')
continue
if N > 0:
    break
print('Invalid input: not positive.')
Factorial calculation using Python