I am attempting to reassign variables inside nested for loops. I'd like to get the index for the number 6 inside a list of lists, but it's not working. Why isn't it working and how can I fix it?
Here's the code:
row = 0
col = 0
a = [[1, 2, 3, 4, 5], [3, 4, 4, 6, 9]]
for i in range(len(a)):
for j in range(len(a)):
if a[i][j] == 6:
row = i # expect row = 1
col = j # expect col = 3
print(row) # prints 0
print(col) # prints 0