How to access list elements in python?
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)
e.g.,
l=['python', 'C', 'C++', 'Java', 'Cpython'] print(l[2])
This is how we can access elements of list in python.
Subscribe
Login
Please login to comment
0 Discussion