
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to Find Factorial of Number Using Recursion in Python?
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
- Related Articles
- C++ Program to Find Factorial of a Number using Recursion
- Java Program to Find Factorial of a Number Using Recursion
- Haskell Program to Find Factorial of a Number Using Recursion
- Python Program to find the factorial of a number without recursion
- Java program to find the factorial of a given number using recursion
- How to Find the Factorial of a Number using Python?
- C++ program to Calculate Factorial of a Number Using Recursion
- Write a Golang program to find the factorial of a given number (Using Recursion)
- How to Find the Power of a Number Using Recursion in Python?
- Factorial program in Java using recursion.
- Factorial program in Java without using recursion.
- Factorial recursion in JavaScript
- Python program to find factorial of a large number
- How to Find Sum of Natural Numbers Using Recursion in Python?
- C++ Program to Find Factorial of a Number using Iteration

Advertisements