functoolsreduce
functools.reduce is a function in the Python standard library that applies a binary function cumulatively to the items of an iterable, from left to right, to produce a single value. It is defined in the functools module; in Python 2 it was a built-in function, but in Python 3 it resides in functools and is imported with from functools import reduce.
Signature and behavior: reduce(function, iterable [, initializer]). The function is called with two arguments: the accumulated value
Examples: reduce(lambda a, b: a + b, [1, 2, 3, 4]) returns 10. reduce(lambda a, b: a * b,
Notes: reduce implements a left fold, applying the function from the first element (or the initializer) toward