Python factorial code of a number : For an integer n greater than or equal to 1, the factorial is the product of all integers less than or equal to n but greater than or equal to 1. The factorial value of 0 is defined as equal to 1. The factorial values for negative integers are not defined.

For eg : factorial of 5 i.e 5!=5*4*3*2*1=120.

While calculating permutation and combination, Factorial program can be referred.

## Python Factorial code

print ': Factorial:\n' def Factorial(): n = input ('Enter the number to find factorial: ') fact=1 for i in range(1,n+1): fact=fact*i print('Factorial of a number %d is %d'%(n,fact))

Output :

: Factorial: >>> Factorial() Enter the number to find factorial: 5 Factorial of a number 5 is 120 >>>