What's the simplest way to get the highest and lowest keys from a dictionary?

Posted by Jorge on Stack Overflow See other posts from Stack Overflow or by Jorge
Published on 2010-04-15T09:17:29Z Indexed on 2010/04/15 9:33 UTC
Read the original article Hit count: 183

Filed under:
|
|
|
self.mood_scale = {
    '-30':"Panic",
    '-20':'Fear',
    '-10':'Concern',
    '0':'Normal',
    '10':'Satisfaction',
    '20':'Happiness',
    '30':'Euphoria'}

I need to set two variables: max_mood and min_mood, so I can put some limits on a ticker. What's the easiest way to get the lowest and the highest keys?

© Stack Overflow or respective owner

Related posts about python

Related posts about dictionary