Here in this tutorial, we will tell you how to find the fictorial of a number. Through this Python example, you will get complete knowledge of this Python program.

The factorial of a number is basically the multiplication of all the integers starting from 1 to that number.

```
For example:
The factorial of 5 (5!) is 5*4*3*2*1 = 120
```

Note: The factorial of negative numbers are not defined and the factorial of 0 (0!) is 1.

```
```### Python Code

# Python program to find the factorial of a number provided by the user.
# change the value for a different result
num = 8
# uncomment to take input from the user
#num = int(input("Enter a number: "))
factorial = 1
# check if the number is negative, positive or zero
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1,num + 1):
factorial = factorial*i
print("The factorial of",num,"is",factorial)
### Output

The factorial of 8 is 40320

Note: If you want to test this program, change the values and run it. Also, you can try negative numbers in this program.

Important Links
Go to Python Training Homepage
Download Python 3.7.0 .
How to Install Python ?
Let's start working with Python IDLE
Want to make Career in Python?
Want to know about Python Unique Features
Learn Python with Data Science.
Learn more about Data Visualization with Python
Top 10 Data Science Libraries Using Python
Why Choose Python for Artificial Intelligence?
Machine Learning: Let's Begin Learning How to train Machines to Learn.
Here are Top 10 Python Libraries for Machine Learning
Learn About Python Exception Handling
What is Artificial Neural Network?