Use OrderedDict or ordered list?(novice)
Question: (Using Python 3.4.3) Here's what I want to do: I have a dictionary where the
keys are strings and the values are the number of times that string occurs in
file. I need to output which string(s) occur with the greatest frequency,
along with their frequencies (if there's a tie for the most-frequent, output
all of the most-frequent).

I had tried to use OrderedDict. I can create it fine, but I struggle to get it
to output specifically the most frequently occurring. I can keep trying, but
I'm not sure an OrderedDict is really what I should be using, since I'll never
need the actual OrderedDict once I've determined and output the most-frequent
strings and their frequency. A fellow student recommended an ordered list, but
I don't see how I'd preserve the link between the keys and values as I
currently have them.

Is OrderedDict the best tool to do what I'm looking for, or is there something
else? If it is, is there a way to filter/slice(or equivalent) the OrderedDict?


Answer: You can simply use `sorted` with a proper key function, in this case you can
use `operator.itemgetter(1)` which will sorts your items based on values.

    
    
    from operator import itemgetter
    
    print sorted(my_dict.items(),key=itemgetter(1),reverse=True)
    

