functools.reduce
allows you to apply a function cumulatively to the items of an iterable.
The code above combines functools.reduce
and operator.add
to get the cumulative sum of a list.
functools.reduce
allows you to apply a function cumulatively to the items of an iterable.
The code above combines functools.reduce
and operator.add
to get the cumulative sum of a list.