- #1
zeion
- 466
- 1
Homework Statement
Hi there,
I need to sort a Python dictionary based on its values which are ints, then return the ordered list as the keys.
I am thinking to make the inverse of the dictionary, take values and sort, then map back with the inverse dictionary.
The problem is that when there are identical values, the inverse dictionary will not store the same value twice as the same key.. so a combination is lost.
I tried to work around it by adding one to the value if the value is repeated, which should not change the sorting.. but am having trouble writing the code.
Any help?