I am trying to access specific elements in a list within a for loop. However, when a repeated item appears the index is given for the first instance.
For example:
my_list = [1,2,2,3,2,1]
for i in my_list:
return my_list.index(i)
When the for loop has reached the last element it will return 0 rather than my desired output of 5. How do I get the index of the specific 'i' the loop is using?