I am having a 2D array.
grid[0][0]= hat
grid[0][1]= cat
grid[1][1]= bat
Now, if I have the value cat, could I retrieve those index i.e [0][1]
You could iterate over all the elements like this:
def find(needle, hay):
for x in hay:
for y in x:
if hay[x][y] == needle: return x, y
return -1, -1
And then use this function
find('cat', grid)
clickleft side and accept. you will also get some point