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

1 Answer

+1 vote
by (233k points)

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)