Add up one to five · บวกหนึ่งถึงห้า
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 · Counting loops · วนซ้ำแบบนับจำนวน →
English
Add up one to five
Use a for loop to add 1 + 2 + 3 + 4 + 5 into total.
range(1, 6) gives 1 to 5: it starts at the first number and stops before the second. Add each one onto a total that starts at 0.
ไทย
บวกจากหนึ่งถึงห้า
ใช้ for loop บวก 1 + 2 + 3 + 4 + 5 ลงใน total
range(1, 6) ให้ 1 กับ 5: มันเริ่มที่ตัวเลขแรกและหยุดก่อนตัวเลขที่สอง บวกแต่ละตัวเข้าไปในผลรวมที่เริ่มต้นที่ 0
Use a for loop to add 1 + 2 + 3 + 4 + 5 into total. · ใช้ for loop บวก 1 + 2 + 3 + 4 + 5 ลงใน total
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่