Lets say you have this nested dictionary:
myDict = {
0: { 'bob': [1, 9, 4, 6, 7],
'jack': [2, 6, 9, 8, 5, 0]}
1: { 'dom': [1, 7, 8, 5],
'dean': [1, 9]}
}
How do you sort myDict[0] by the greatest of the last three values, so the output can be something like (with jack ahead of bob):
jack -> 8
bob -> 7
Thank you in advance
Dictionaries are accessed by key's, you can't sort them in python. You can however, EXTRACT the data and put it into a list - after which, sorting the data is rather easy!
For example, you can do:
If you want the greatest of the last three values: