should look like this:
1 --- 1
2 --- 4
3 --- 9
...
20 --- 400
for i in range(1, 21):
print(f"{i} --- {i ** 2}")
This code will loop through the numbers 1 to 20, and for each iteration it will print the number followed by "---" and the square of the number. The ** operator is used to calculate the square of the number.
To run this code, you can save it to a file with a .py extension and run it using the python command in a terminal or command prompt.

0 Comments