If you want to apply a function of two arguments cumulatively to the items of iterable from left to right, use functools’s reduce. This method reduces the iterable to a single value.
In the code below, 3 is the result of the function add_nums(2, 1). 3 is then used as the first argument of the function add_nums(3, 2).


