sorting dictionary values in python - descending alphabetically
Question: I have a dictionary:-

    
    
    higharr = {'Alex':2,
               'Steve':3,
               'Andy':4,
               'Wallace':6,
               'Andy':3,
               'Andy':5,
               'Dan':1,
               'Dan':0,
               'Steve':3,
               'Steve':8}
    
    for score in sorted(higharr.values(), reverse=True):
        print (score)
    

I would like to print out the keys with the values with the values being in
descending alphabetical order. The descending part is working but I am unsure
about how to add the corresponding key to the left of it.

Thank you


Answer: You may use another data-structure, because you have duplicate keys. But in
general you might consider this:

    
    
    from operator import itemgetter
    for i in sorted(higharr.items(), key=itemgetter(1), reverse=True):
        print i
    

