The last occurrence of an element in a list is same as the first occurrence of that element in the reversed list.
So the index of last occurrence of an element in original list is equal to (length_of_list - index_in_reversed_list - 1).
You can use the list.reverse()
method to reverse the list and then find the index of first occurrence of the required element in reversed list by list.index()
method.
For example:
>>> mylist = [1,12,3,4,4,5,12,15,13,11]
>>> temp = mylist[:]
>>> temp.reverse()
>>> index = len(temp) - temp.index(12) - 1
>>> print(index)
6