Python Program to Find Factorial of Number Using Recursion

To understand this example, you should have the knowledge of the following Python programming topics:


The factorial of a number is the product of all the integers from 1 to that number.

For example, the factorial of 6 is 1*2*3*4*5*6 = 720. Factorial is not defined for negative numbers and the factorial of zero is one, 0! = 1.

Source Code

Output

The factorial of 7 is 5040

Note: To find the factorial of another number, change the value of num.

Here, the number is stored in num. The number is passed to the recur_factorial() function to compute the factorial of the number.