+5 votes
in Programming Languages by (71.8k points)
What python function should I use to find the factorial of an integer?

1 Answer

+2 votes
by (349k points)
selected by
 
Best answer

The factorial() function of the math library can be used to compute the factorial of any integer.

The math module of NumPy also has the factorial() function.

Example:

>>> import numpy as np
>>> np.math.factorial(5)
120

>>> import math
>>> math.factorial(5)
120
 


...