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:
[…] List.index: To find the index of an […]