Python – Find last index of element in list with duplicate elements python

python

I have a list like this : [1,12,3,4,4,5,12,15,13,11]

I want to find index of 12 i.e 6.
I have tried linear approach but it is not efficient.

item = 12
for i in range(len(mylist)):
    if mylist[i] == item:
        index = i
return index

Any efficient way to get this ?

Best Solution

Go from right to left:

mylist = [1,12,3,4,4,5,12,15,13,11]
item = 12
for i in range(len(mylist)-1,-1,-1):
    if mylist[i] == item:
        index = i
        print(index)
        break