A list of squares
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
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.
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].
Click Run to see the output here.