python 누적합

Hvvany·2023년 4월 13일
0

알고리즘

목록 보기
9/12
from itertools import accumulate

a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b = list(accumulate(a))
print(a)  # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(b)  # [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
profile
Just Do It

0개의 댓글