Star triangle · สามเหลี่ยมดาว
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
Star triangle
Print a triangle of stars four rows high: one star, then two, then three, then four.
Multiplying a string repeats it: "ab" * 3 is "ababab". Let the loop variable say how many stars each row needs.
ไทย
สามเหลี่ยมดาว
พิมพ์สามเหลี่ยมของดาวสูงสี่แถว: ดาวหนึ่งดวง แล้วสองดวง สามดวง และสี่ดวงตามลำดับ
การคูณสตริงจะทำให้ทำซ้ำสตริง: "ab" * 3 คือ "ababab" ให้ตัวแปรของลูประบุจำนวนดาวที่ต้องใช้ในแต่ละแถว
Print a triangle of stars with 4 rows: *, **, ***, ****. Use a loop and "*" * n. · พิมพ์สามเหลี่ยมดาวจำนวน 4 บรรทัด: *, **, ***, **** ใช้ลูปและ "*" * n
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่