Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created January 18, 2021 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/0c8c378b216217b9c3f80e1c7480f4bf to your computer and use it in GitHub Desktop.
Save BetterProgramming/0c8c378b216217b9c3f80e1c7480f4bf to your computer and use it in GitHub Desktop.
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