The other answers are great. I’ll simply add an illustrated example that I find pretty good to understand reduce()
:
>>> reduce(lambda x,y: x+y, [47,11,42,13])
113
will be computed as follows:
(Source) (mirror)
The other answers are great. I’ll simply add an illustrated example that I find pretty good to understand reduce()
:
>>> reduce(lambda x,y: x+y, [47,11,42,13])
113
will be computed as follows:
(Source) (mirror)