A list of squares
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
อันนี้สร้างจากบทเรียนที่คุณยังไม่เสร็จสิ้น ให้ทำบทเรียนนั้นก่อน:
Python Basics · Lists (1-D arrays) →
รายการกำลังสอง
สร้างรายการไอเท็มละตัว แทนที่จะพิมพ์แต่ละค่า
squares.append(x) adds x to the end of the list. Printing a whole list shows it in square brackets, with commas between the items.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Start with an empty list, add the squares of 1 ไป 5 with .append(), then print the list. It should show [1, 4, 9, 16, 25].
คลิก Run เพื่อดูผลลัพธ์ที่นี่