for example, there is a list:
numbers = [1,2,3,4,2,1]
print(numbers.index(1))
output is
0
element behind is preferred means that, the index of the "1" at the end should be printed instead of the the "1" at the beginning.
i.e.
output should be 5
A baseline method of "reverse the list" is provided bellow, it there a faster & simpler way to do this?
numbers = [1,2,3,4,2,1]
numbers.reverse()
output = []
for i in range(1,4):
inv_inx= len(numbers)-numbers.index(i)-1
output.append(inv_inx)
print(output)
assert output == [5, 4, 2]