Python Program to find factorial of a number using function
In this program, You will learn how to find factorial of a number using function in Python.
3! = 1 * 2 * 3 => 6
4! = 1 * 2 * 3 * 4 => 24
Example: How to find factorial of a number using function in Python.
def find_factorial(n):
f = 1
for i in range(1, n + 1):
f = f * i
return f
x = int(input("Enter a number:"))
result = find_factorial(x)
print("Factorial is:", result)
Output:
Enter a number:4
Factorial is: 24