Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Sum a list · ⁨รวมรายการ⁩

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.

ไทย

รวมลิสต์

บวกทุกตัวเลขในลิสต์และ return ผลรวมทั้งหมด. เริ่มต้นผลรวมสะสมที่ 0, จากนั้นวนซ้ำผ่านลิสต์และเพิ่มแต่ละค่าเข้าไป

รูปแบบนี้ — ผลรวมสะสมที่เพิ่มขึ้นภายในลูป — ปรากฏทั่วไปในทุกการเขียนโปรแกรม

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP