actual case:
English scores are stored in a class dictionary in the form of:
{
'LiLei': 90,
'Jim' : 88,
'Lucy': 92
}
How the level of achievement, students calculate rankings
- Depending on the score, ranking, and ranking information to add to the dictionary
solution
First thought -
The conversion dictionary is the tuple using a built-in function sorted ordering (
--sorted - not directly to the dictionary, sorted according to values - need to be converted
- the conversion to the dictionary for tuple, the tuple in a list, sort the list
--
Option One:
The dictionary entry is converted (key, value) tuple (or zip parsing mode list ---
Scheme 2: Transfer Function key parameter sorted
Updated rankings:
Original Dictionary Update:
New Dictionary Update: