How to access list elements in python?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Green-and-Purple-Dynamic-Frames-Action-_-Adventure-YouTube-Channel-Art-8-1024x576.jpg)
We can access elements of list by index() function in python.
Here we’ll see some examples to access elements of list.
index()- It will give index number of the element in the list.
e.g.,
l=['python', 'C', 'C++', 'Java', 'Cpython'] i=l.index('Java') print(i)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1032-1024x169.png)
e.g.,
l=['python', 'C', 'C++', 'Java', 'Cpython'] print(l[2])
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1034-1024x182.png)
This is how we can access elements of list in python.
Subscribe
Login
Please login to comment
0 Discussion