4 ms·
Just not included in to the standard library (it doesn't really have a common use case), but certainly implementable, and without loops to boot! >>> def ti
by falcolas 11y ago
Just not included in to the standard library (it doesn't really have a common use case), but certainly implementable, and without loops to boot!
>>> def times(input):
... return reduce(lambda x, y: x*y, input, 1)
...
>>> times(range(1,11))
3628800
- agumonkey 11y agoOf course, it's just weird to see `sum` built-in all alone. They even have operator.mul so... >>> Prod = lambda xs: fp.reduce(op.mul, xs, 1) >>> Prod(range(1,11)) 362880