python get index of item in 2d list

Solutions on MaxInterview for python get index of item in 2d list by the best coders in the world

showing results for - "python get index of item in 2d list"
Gino
03 Jun 2020
1myList = [[1, 2], [3, 4], [5, 6]]
2
3
4def index_2d(myList, v):
5    for i, x in enumerate(myList):
6        if v in x:
7            return i, x.index(v)
8
9
10print(index_2d(myList, 3))
11# you get
12# (1, 0)
queries leading to this page
python index of element in 2darrayreaching index of elements in 2d list pythonpython get index of item in listhow to get index from 2d array pythonget index of an element in a list pythonfind index of element in 2d list pythonfind index of a row in 2d array pythonpython 2d list find indexfind index of element in 2dlist pythonhow to find the index of an element in a 2d 27 list in pythonfind index of array in 2d array pythonget index of 2d array pythonget position of value in 2d array pythonpython list 2d indexhow to find the index of an element in a 2d list in pythonfind index of value in 2d array python2d item listpython index of element in 2d arrayto find index of element in 2d array pythonget index of element in 2d array pythonhow to get index of 2d array in pythonpython 2d list get indexpython find index of element in 2d arraypython how to find index of an element in a 2d listpython how to find index of 2d listpython get all index value in 2d arraypython find index of value in 2d arrayhow to find index of element in 2d list pythonhow to find index of an element in a 2d list pythonhow to tell the index of 2d listfind index of 2d array pythonget index of element in 2d list pythonindex of value in double list pythonget inde for element in 2d listpython find index in 2d arrayfind index of a number in 2d array pythonfind index of item in 2d list pythonfinding index of 2d listpython find index in 2d listget index of item in 2d list python2d array get index pythonhow to get the index of a 2d list in pythonhow to get second value in 2 d list pythoninbuilt funtion find the index of an element in a 2d list pythonhow to return index of 2d list in pythonfind position of element in 2d list pythonfind index of element in 2d array pythonhow to get index of element in a 2d list pythonpython get index of item in 2d listfind index of a 2d array pythonfind index in 2d array pythonfind the index of an element in a 2d list pythonpython get index of item in 2d list