1# Basic syntax:
2list.index(element, start, end)
3# Where:
4# - Element is the item you're looking for in the list
5# - Start is optional, and is the list index you want to start at
6# - End is option, and is the list index you want to stop searching at
7
8# Note, Python is 0-indexed
9
10# Example usage:
11my_list = [1, 2, 3, 4, 5, 6, 7, 8, 42, 9, 10]
12my_list.index(42)
13--> 8
1# alphabets list
2alphabets = ['a', 'e', 'i', 'o', 'g', 'l', 'i', 'u']
3
4# index of 'i' in alphabets
5index = alphabets.index('i') # 2
6print('The index of i:', index)
7
8# 'i' after the 4th index is searched
9index = alphabets.index('i', 4) # 6
10print('The index of i:', index)
11
12# 'i' between 3rd and 5th index is searched
13index = alphabets.index('i', 3, 5) # Error!
14print('The index of i:', index)
1# Find index position of first occurrence of 'Ok' in the list
2indexPos = listOfElems.index('Ok')
3
4print('First index of element "Ok" in the list : ', indexPos)
5