15.9k views
20 votes
Write a program that prints out a list of the integers from 1 to 20 and their

squares. The output should look like this:
1-1
2-4
3-9
20-400

User Dan Gibson
by
5.2k points

1 Answer

11 votes

Answer:

for x in range(1,20):

print(f'{x}-{(x**2)}')

User HellaMad
by
5.3k points