[issue2138] Add a factorial function

Joshua Uziel report at bugs.python.org
Sat May 31 12:33:34 CEST 2008


Joshua Uziel <python at uzix.org> added the comment:

It's a simplified version, but why not something like this:

import operator
def factorial(num):
    return reduce(operator.mul, range(1, num+1))

A product() function could also be done similarly.

----------
nosy: +uzi

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2138>
_______________________________________


More information about the Python-bugs-list mailing list