123456789101112131415161718192021222324252627282930313233 |
- print("This code was developed by @PythonCoder8 on Github. To see @PythonCoder8's profile go to github.com/PythonCoder8/.")
- import sys
- userInput = input("Enter a number: ")
- if isinstance(userInput, float) == True:
-
- sys.exit("Decimals are not allowed. Only whole numbers are.")
- try:
- userNumber = int(userInput)
- except:
- sys.exit("Your input is not a number. Exiting Program.")
- userProduct=1
- for i in range(1,userNumber+1):
-
- userProduct *= i
- print("The factorial of %s (!%s) is %d" %(userInput, userInput, userProduct))
|