For instance, we have a list of list. The list should be reverse sorted based on some index i, and if there is tie, they should be sorted in ascending or descending order based on the condition.
For eg:
The list is [['A', 2, 4.2], ['B', 4, 4.5], ['C', 2, 3.3], ['D', 2, 3.5]]
How to sort this so that the result is:
[['B', 4, 4.5], ['A', 2, 4.2], ['D', 2, 3.5], ['C', 2, 3.3]][['B', 4, 4.5], ['C', 2, 3.3], ['D', 2, 3.5], ['A', 2, 4.2]]
In first condition, i want them to be sorted in descending order based on index 1, and then again on descending order on index 2 if there is tie on index 1.
In second condition, i want them to be sorted in descending order based on index 1, and then in ascending order on index 2 if there is tie on index 1.