Sum a list · 列表 합계하기
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
This one builds on a lesson you haven't finished yet. Do that lesson first: · 이 과제는 아직 완료하지 않은 수업에 기반합니다. 먼저 해당 수업을 완료하세요:
Python Basics · Functions →
English
Sum a list
Add up every number in a list and return the total. Start a running total at 0, then loop over the list and add each value to it.
This pattern — a running total that grows inside a loop — comes up everywhere in programming.
한국어
리스트 합계 구하기
리스트의 모든 수를 더해서 총합을 반환합니다. 누적 합계를 0로 시작하고, 리스트를 순회하며 각 값을 더하세요.
이 패턴 — 루프 내에서 커지는 누적 합계 — 은 프로그래밍에서 어디나 나타납니다.
Write sum_list(xs) that returns the total of all numbers in the list xs. An empty list sums to 0. · sum_list(xs)를 작성하여列表 xs의 모든 숫자의 총합을 반환하십시오. 빈列表의 합은 0입니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.