So i have this dictionary in (Python 3.x) :
dict = {
"Gryffindor": gryffcount,
"Ravenclaw": ravencount,
"Hufflepuff": hufflecount,
"Slytherin": slycount
}
gryffcount
, ravencount
, hufflecount
and slycount
are int
variables.
And I want to output a list in which : - the first item should be the key for which the value is the highest - the second one should be the key for which the value is the second highest - and so on... EDIT : but if two counts are equal then the one that was mentioned first in the dictionary should appear first.
So if gryffcount == 0, ravencount == 2, hufflecount == 0, slycount == 4
I should get this list :
["Slytherin","Ravenclaw","Gryffindor","Hufflepuff"]