My prompt: "Write a program that uses two nested while loops to print off the rows and columns of a 3x3 grid (numbered 1 to 3), excluding the cells along the diagonal (i.e., where the row and column have the same value). The first three rows of your program's output should look like this:
1 2
1 3
2 1
I have coded it pretty well so far, but I am stuck with one extra unwanted output. How do I remove it?
row = 0
while row < 3:
col = 0
row += 1
while col < 3:
col += 1
if row == col:
col += 1
print (row, col)
expected result should be:
1 2
1 3
2 1
2 3
3 1
3 2
but 3 4 is included as well.