To find the index or position of an object in list list.index function is used.e.g In list a if we want to find index of object guavava it will be written as

a=[‘orange’, ‘mango’, ‘guavava’, ‘apple’]

a.index(‘guavava’)

Output:2

guavava is present at 2nd index as clearly visible.

Note:In Python indexing begins from Zero(0).

How to use List.Index() in Python:

how to write list.index in python
1.List index in Python

 

By SC

One thought on “List.index”

Leave a Reply

Your email address will not be published. Required fields are marked *