from itertools import accumulate
li = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ac = list(accumulate(li))
print(li)
print(ac)
출력값
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
from itertools import accumulate
li = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ac = list(accumulate(li))
print(li)
print(ac)
출력값
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[1, 3, 6, 10, 15, 21, 28, 36, 45, 55]