How can I sort an already sorted list by another index?
example: I have a list that is sorted by index 1.
[["DOG", 5], ["DAM",5], ["DAN", 5], ["BAT", 4], ["CAT", 3], ["MAN", 2]]
I want the following output:
[["DAM", 5], ["DAN",5], ["DOG", 5], ["BAT", 4], ["CAT", 3], ["MAN", 2]]
The list has been sorted by index 1. If an index 1 has multiple occurences in the list, how should I sort index 0 so that the overall nested list retains its order in terms of index 0?