How to find the position of element in a list of lists?
Let's say I have a list of lists: [['a','b','c'], ['a','b','c'], ['b','a','d']]. What code would allow me to get the the coordinates of 'a' (index, row) as a list of tuples? Ex: [(0,0), (1,0), (1,2)]?
- EddieJLv 79 months ago
Usually, the first thing you would do would be to assign your list of lists to a variable.
Then you would use a <for> loop to go through each element of the main list.
Then you could use the .index ('a') method.