Factorial Geekboots | Python Programming | Jun 06, 2016 #!/usr/bin/evn python # Take input from the user num = int(input("Enter a number to calculate factorial: ")) factorial = 1 # Check if the number is negative, positive or zero if num < 0: print("Sorry, factorial does not exist for negative numbers") elif num == 0: print("The factorial of 0 is 1") else: # For loop iterating by sequence index for i in range(1,num + 1): factorial = factorial*i print("The factorial of",num,"is",factorial) #***** Output ***** Enter a number to calculate factorial: 5 The factorial of 5 is 120 Learn more about For Loop python python language python programming python coding for factorial factorial in python geekboots tutorial geekboots python programming python code for factorial calculation