August 2018
Intermediate to advanced
366 pages
10h 14m
English
The steps for this recipe are as follows:
>>> values = [ 1, 2, 3, 4, 5 ]
>>> import functools, operator >>> functools.reduce(operator.add, values) 15
>>> import itertools >>> list(itertools.accumulate(values, operator.add)) [1, 3, 6, 10, 15]