Created
January 18, 2021 16:12
-
-
Save BetterProgramming/0c8c378b216217b9c3f80e1c7480f4bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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