Learn about Factorial Program in Python using math.factorial() in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Factorial Program in Python using math.factorial()
# Python program to find the factorial of a number using math function #math module import math # input num = 5 # factorial of a number print('The factorial of',num,'is', math.factorial(num))
The factorial of 5 is 120
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Get First Digit of Number in Python using Slicing