Factorial of any number is multiplication of all 1,2,3,4,.... upto that number.
Example -
5!=1*2*3*4*5
4!=1*2*3*4
program -
import math
print("Enter number")
n=int(input())
#first way
ans=1
for i in range(1,n+1):
ans=ans*i
print("Factorial is - "+str(ans))
#second way
print("Factorial is - "+str(math.factorial(n)))
Enter number
5
Factorial is - 120
Factorial is - 120
-In this program, the first way use the loop which start with the one and end on the given number and continuously increase and multiple in 'ans' variable and ans have factorial of given number while in second way we use direct build-in function 'factorial()' which is define in the math library so that's by we import the math library by import math