How to get an index of list in python?
![](https://pythonpoint.net/wp-content/uploads/2020/11/Yellow-and-Blue-Initiative-Blog-Banner-14-1024x576.jpg)
A list is a data structure, or it can be considered a container that can be used to store multiple data at once. The list will be ordered and there will be a definite count of it. The elements are indexed according to a sequence and indexing is done with 0 as the first index.
We use index() function to get an index.
e.g.,
l=[1, 2, 3, 4, 5, 6, 7, 8, 9, 0] i=l.index(3) print(i)
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-889-1024x469.png)
e.g.,
a=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] index=a.index('e') print(index)
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-891-1024x411.png)
This is all about getting index of list.
Subscribe
Login
Please login to comment
0 Discussion