Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from itertools import accumulate
num1=[1,2,3,4,5]
num2=accumulate(num1,lambda x,y:x*y,)
print (num2)
#Output:<itertools.accumulate object at 0x02FE35C8>
print (list(num2))
#Output:[1, 2, 6, 24, 120]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment