+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 (348k 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.


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

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