The following:
i = 0
for y in range(0, 500, 125):
for x in range(0, 750, 125):
print('(%3d, %3d): %3d ' % (x, y, i), end='')
i += 1
print()
produces
( 0, 0): 0 (125, 0): 1 (250, 0): 2 (375, 0): 3 (500, 0): 4 (625, 0): 5
( 0, 125): 6 (125, 125): 7 (250, 125): 8 (375, 125): 9 (500, 125): 10 (625, 125): 11
( 0, 250): 12 (125, 250): 13 (250, 250): 14 (375, 250): 15 (500, 250): 16 (625, 250): 17
( 0, 375): 18 (125, 375): 19 (250, 375): 20 (375, 375): 21 (500, 375): 22 (625, 375): 23
Alternatively, with a single loop:
for i in range(24):
print('(%3d, %3d): %3d ' % (i % 6 * 125, i // 6 * 125, i), end='')
if (i + 1) % 6 == 0:
print()
5
solved How to print in range? [closed]