Python program to find factorial of a number

The Factorial of a number is the product of all the integers from 1 to that number.For example The factorial of 5 is 120 that is calculated as (1*2*3*4*5).

Method 1: factorial( ) function

Python providing the standard math library to find a factorial of a number in a single step.We can calculate the factorial of the number using factorial function in python as below.

Program

Output:
The factorial of 5 is: 120
The factorial of 6 is: 720
The factorial of 7 is: 5040
The factorial of 8 is : 40320

Method 2: Using the for loop to find the factorial of a number

Program

Output: