# How to Find Factorial of Number Using Recursion in Python?

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

Factorial of a number is product of all numbers from 1 to that number.

A function is called a recursive function if it calls itself.

In following program factorial() function accepts one argument and keeps calling itself by reducing value by one till it reaches 1.

## Example

def factorial(x):
if x==1:
return 1
else:
return x*factorial(x-1)

f=factorial(5)
print ("factorial of 5 is ",f)

## Output

The result is

factorial of 5 is  120

Updated on 21-Feb-2020 12:54:14