I'm trying to insert some tuples into a 2D array, but for some reason, the x value doesn't seem to increase.
x_axis = 20
y_axis = 4
arr = [[None]*y_axis]*x_axis
for x in range(x_axis):
for y in range(y_axis):
arr[x][y] = (x,9,y,6)
for x in range(x_axis):
for y in range(y_axis):
print arr[x][y]
I'm getting this:
(19, 9, 0, 6)
(19, 9, 1, 6)
(19, 9, 2, 6)
(19, 9, 3, 6)
(19, 9, 0, 6)
(19, 9, 1, 6)
(19, 9, 2, 6)
(19, 9, 3, 6)
(19, 9, 0, 6)
(19, 9, 1, 6)
(19, 9, 2, 6)
(19, 9, 3, 6)
(19, 9, 0, 6)
(19, 9, 1, 6)
(19, 9, 2, 6)
(19, 9, 3, 6)
(19, 9, 0, 6)
(19, 9, 1, 6)
(19, 9, 2, 6)
(19, 9, 3, 6)
I have no idea why the x
is sticking to 19 (the last number of the range) and not just counting from 0-19 inclusive.