KKG
Programming
KKG
전체 방문자
오늘
어제
  • 전체 글 보기 (84)
    • 회고 (9)
    • Bootcamp (19)
    • Error Handling (2)
    • Kotlin (1)
    • Java (19)
      • Java (14)
      • Spring (1)
      • JPA (2)
      • Link (2)
    • Python (5)
    • 알고리즘 (20)
      • 알고리즘 (4)
      • 백준 (14)
      • 프로그래머스 (1)
      • Link (1)
    • SQL (5)
      • SQL (1)
      • MySQL (4)
    • Web (2)
    • etc (1)

블로그 메뉴

  • 태그
  • 방명록
  • 깃허브

인기 글

티스토리

hELLO · Designed By 정상우.
KKG

Programming

Python

[Python] 누적합 itertools.accumulate

2022. 1. 29. 10:43
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]

 

    'Python' 카테고리의 다른 글
    • [Python] 중복순열, 중복조합(itertools.product, combinations_with_replacement)
    • [Python] collections.Counter
    • [Python] 순열, 조합(itertools.permutations, combinations)
    • [Python] 힙 자료구조 Heapqueue

    티스토리툴바