I want to Sort the dictionary by score. if the score is same then sort them by name
{
'sudha' : {score : 75}
'Amruta' : {score : 95}
'Ramesh' : {score : 56}
'Shashi' : {score : 78}
'Manoj' : {score : 69}
'Resham' : {score : 95}
}
Help plz
Thanks.
I think this should work…
It works by comparing tuples (score,name). Tuple comparison looks at the first item — if those are the same, it looks at the second item and so forth. So, (55,’jack’) > (54,’lemon) and (55,’j’) < (55,’k’).
Of course, this returns the keys of
yourdictin the order desired — there’s no way to actually sort a dictionary since dictionaries have no concept of order.