13.8k views
0 votes
Write a code segment that uses a loop to create and place nine labels into a 3-by-3 grid. The text of each label should be its coordinates in the grid, starting with (0, 0). Each label should be centered in its grid cell. You should use a nested for loop in your code.

User Mcmhav
by
7.4k points

1 Answer

2 votes

Answer:

The question is answered using Python:

for i in range(0,3):

for j in range(0,3):

print("("+str(i)+", "+str(j)+")",end=' ')

num = int(input(": "))

Step-by-step explanation:

The programming language is not stated. However, I answered using Python programming language

The next two lines is a nested loop

This iterates from 0 to 2, which represents the rows

for i in range(0,3):

This iterates from 0 to 2, which represents the columns

for j in range(0,3):

This prints the grid cell

print("("+str(i)+", "+str(j)+")",end=' ')

This prompts user for input

num = int(input(": "))

User Dan Bechard
by
8.7k points