Python list index

In this article, you’ll see how to find the index of an element of a list in Python. The index method is used to show the index position of an element. The index method takes only one argument. The argument is the element whose index you want to find. I highly recommend you get the “Python Crash Course Book” to learn Python.

a = [10, 15, 10, 20, 25]
print(a.index(10))

Output:

0
a = [10, 15, 10, 20, 25]
print(a.index(25))

Output:

4

Leave a Comment

Your email address will not be published.