I am trying to reverse the index given by enumerate
whilst retaining the original order of the list being enumerated.
Assume I have the following:
values = 'abcde'
for i, value in zip(reversed(range(len(values))), values):
print(i, value)
Explanation:
values = 'abcde'
values_len = len(values) # 5
indexes = range(values_len) # [0, 1, 2, 3, 4]
reversed_indexes = reversed(indexes) # [4, 3, 2, 1, 0]
# combine reversed indexes and values
reversed_enumerator = zip(reversed_indexes, values)
for i, value in reversed_enumerator:
print(i, value)