Reduce
Reduce takes a list, a binary operation, and an identity element for the operation. It returns a value representing the binary operator applied to successive application of the operations to intermediate results.
Last updated 7 years ago
Was this helpful?
from functools import reduce product = reduce((lambda x, y: x * y), [47, 11, 42, 13]) # Output: 113