I understand that are inertion sorted. I am trying to make a new dictionary that sorts alphabetically on the 'Key' and then sorts the values on the last element in the tuple.
Dictionary Currently:
D1 = {'Lakers': [('James','PG',23,2), ('Davis', 'PF', 3, 3), ('Johnson', 'PG', 33,
1)], 'Pistons': [('Billips', 'PG', 1, 1 ), ('Wallace', 'C', 3, 3)], 'Hawks':
[('Young', 'PG', 11, 1), ('Collins', 'PF', 3, 2)] }
Dictionary I want:
New_D1 = { 'Hawks':[('Collins', 'PF', 3, 2),('Young', 'PG', 11, 1)], 'Lakers': [('Davis', 'PF', 3, 3),('James','PG',23,2), ('Johnson', 'PG', 33, 1)], 'Pistons': [('Wallace', 'C', 3, 3),('Billips', 'PG', 1, 1 ) ] }
My current Code to Sort is:
New_D1 = dict(sorted(D1.items()))
Which creates a new dictionary (New_D1) and only sorts the Keys. I now need to sort the values in the last element of the list of tuples.