Input:
{'Thiem': (3, 0, 10, 104, 11, 106),
'Medvedev': (1, 2, 11, 106, 10, 104),
'Barty': (0, 2, 8, 74, 9, 76),
'Osaka': (0, 4, 9, 76, 8, 74)}
The expected output should be sorted based on Values of Dict, in the order of attributes in values tuple. Like, firstly on 1st field value(desc), if matching then on 2nd value(desc), till 4th field(desc) and Ascending on 5th & 6th field. I tried using sorted() method in a couple of ways.
output:
Thiem 3 0 10 104 11 106
Medvedev 1 2 11 106 10 104
Osaka 0 4 9 76 8 74
Barty 0 2 8 74 9 76
Kindly assist or suggest an approach.
Edit: Updated description for more clarity. Below is the code i tried:
>>> results=[]
>>> for (k,v) in d.items():
results.append(v)
>>> results.sort(key= lambda x: (x[4],x[5]))
>>> results.sort(key= lambda x: (x[0],x[1],x[2],x[3]), reverse=True)