index() – search for element in list and return index

Code Explanation

LineDescription
1Declaration and initialization of the list myList with the values 1, 2, 3, 4 and 5.
3The index() method returns the index of the specified number.
myList = [1, 2, 3, 4, 5]

print(myList.index(4))
Output
3