Full name
math.factorial
Library
math
Syntax
math.factorial(number)
Description
The math.factorial function returns the factorial of a number. This must be an integer equal to or greater than 0. In the case of being equal to 0, the function will return 1.
Parameters
- number: Number whose factorial is to be obtained.
Result
The result returned by math.factorial is an integer.
Examples
We can obtain the factorial of the number 4 with the following code:
math.factorial(4)
24
The factorial of 0 is 1:
math.factorial(0)
1