Square numbers

Created by Julien Palard

Print the 10 first square number, one per line.

Start at 0, so the first square number is 02, followed by 12, 22, and so on up to 92.

As a reminder, the power operator in Python is written **, so:

>>> 5 ** 2
25

Advices

You'll need a for statement to iterate over the range function.

The for statement is a tool to traverse things containing items. Strings, lists, and ranges are things containing items, so you can use a for to iterate their elements, like:

>>> for c in "Hello":
...     print("The letter is", c)
...
The letter is H
The letter is e
The letter is l
The letter is l
The letter is o

Or like:

>>> for i in [1, 10, 100, 1000]:
...     print(i)
...
1
10
100
1000

Or:

>>> for i in range(10):
...     print(i * 2)
...
0
2
4
6
8
10
12
14
16
18

There's no corrections yet, hit the `Submit` button to send your code to the correction bot.

Keyboard shortcuts:

  • Ctrl-Enter: Send your code to the correction bot.
  • Escape: Get back to the instructions tab.

See solutions