What is the reduce function?
Comprehensions and functional tools
Audio flashcard · 0:15Nortren·
What is the reduce function?
0:15
Reduce, available in functools, applies a binary function cumulatively to elements of an iterable, reducing it to a single value. It is the right tool for aggregations that cannot be expressed with sum, max, min, or any. For most everyday cases, an explicit loop or sum is clearer.
docs.python.org