One of the 50 questions in this topic
How much do you know about Python?reduce() (from the functools module) applies a cumulative function to the elements of an iterable from left to right, reducing the sequence to a single value. For example: reduce(lambda x, y: x + y, [1, 2, 3, 4]) calculates ((1+2)+3)+4 = 10. Unlike map() and filter(), reduce() is not in the global namespace in Python 3, reflecting Guido van Rossum's preference for more explicit constructs such as for loops.