Upside-down 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
Upside-down triangle
Print four rows of stars, starting with four and ending with one.
range counts backwards with a negative step: range(3, 0, -1) gives 3, 2, 1. It still stops before its second number, which is why the stop value is 0.
ไทย
สามเหลี่ยมคว่ำ
พิมพ์ดาวสี่แถว, เริ่มจากสี่ดวงและจบลงที่หนึ่งดวง
range นับถอยหลังด้วยขั้นลบ: range(3, 0, -1) ให้ 3, 2, 1. มันยังหยุด ก่อน ตัวเลขที่สอง, นั่นคือเหตุผลที่ค่าหยุดคือ 0.
Print a triangle of stars that shrinks: ****, then ***, then **, then *. · พิมพ์สามเหลี่ยมดาวที่เล็กลง: ****, แล้ว ***, แล้ว **, แล้ว *
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่