Jul-05-2018, 01:09 PM
In Python how can i sort a two item list based on the condition: if first items are not equal do a normal sort (based on the values of first items), and if the first items are equal sort base on the biggness of second items (the bigger value comes first):
Keys of a dictonary like this:
{(0, 3): (3, 8), (0, 11): (4, 4), (1, 4): (5, 32)}
should be then sorted as such:
[(0, 11), (0, 3), (1, 4)]
Keys of a dictonary like this:
{(0, 3): (3, 8), (0, 11): (4, 4), (1, 4): (5, 32)}
should be then sorted as such:
[(0, 11), (0, 3), (1, 4)]