So here is the pretty basic code i am working with, it is a function that takes a grid in the form of a tuple of tuples. In the loop I have tried to make i the rows and q the columns for the grid.
def myfunc(grid):
for i in (grid):
for q in i:
print("i.index(q): ", i.index(q), " grid.index(i)", grid.index(i))
return True
myfunc(((1, 0, 0, 1, 0),
(0, 1, 0, 0, 0),
(0, 0, 1, 0, 1),
(1, 0, 0, 0, 0),
(0, 0, 1, 0, 0)))
Here is what I get:
i.index(q): 0 grid.index(i) 0
i.index(q): 1 grid.index(i) 0
i.index(q): 1 grid.index(i) 0
i.index(q): 0 grid.index(i) 0
i.index(q): 1 grid.index(i) 0
i.index(q): 0 grid.index(i) 1
i.index(q): 1 grid.index(i) 1
i.index(q): 0 grid.index(i) 1
i.index(q): 0 grid.index(i) 1
i.index(q): 0 grid.index(i) 1
i.index(q): 0 grid.index(i) 2
i.index(q): 0 grid.index(i) 2
and so on.
I expecting and want to get 0, 1, 2, 4, 5, ... for i.index(q), am I not using this function correctly? This seems odd as grid.index(i) is working fine and when I printed q in the for q in i: loop I got the right values.
Any help appreciated!