A list of squares · Daftar kuadrat
A list of squares
Build a list one item at a time instead of printing each value.
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.
Daftar kuadrat
Buatlah daftar satu item pada satu waktu alih-alih mencetak setiap nilainya.
squares.append(x) menambahkan x ke akhir daftar. Mencetak seluruh daftar menampilkannya dalam kurung siku, dengan koma di antara item-itemnya.
Start with an empty list, add the squares of 1 to 5 with .append(), then print the list. It should show [1, 4, 9, 16, 25]. · Mulai dengan daftar kosong, tambahkan kuadrat dari 1 hingga 5 dengan .append(), lalu cetak daftar tersebut. Seharusnya menampilkan [1, 4, 9, 16, 25].
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.