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

Running total · ⁨ผลรวมสะสม⁩

English

Running total

Add up the list [5, 10, 20] one number at a time, printing the total after each step: 5, 15, 35.

Lines indented under the for run every time round the loop; a line after the loop runs only once. Here the print belongs inside the loop.

ไทย

ผลรวมสะสม

บวกรายการ [5, 10, 20] จำนวนหนึ่งตัวเลขในครั้งหนึ่ง, พิมพ์ผลรวมหลังจากแต่ละขั้นตอน: 5, 15, 35.

บรรทัดที่ย่ออยู่ใต้ for จะรันทุกครั้งที่วนรอบลูป; บรรทัดหลังจากลูปจะรันเพียงครั้งเดียว ที่นี่ print อยู่ ภายใน ลูป

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

IGCSE, A-Level & AP