# Factorial of n = n * (n-1) * (n-2) * ... * 1 # Factorial of 0 defined to be 1 # Take input from the user num = int(input("Please enter a positive integer: ")) numsaved = num if num < 0: print("Please enter a positive integer.") else: fact = 1 while num > 0: fact = fact * num num -= 1 print ('Factorial of ' + str(numsaved) + ' is ' + str(fact))