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?
This should do it:
Perhaps not the most efficient (since it has to get and traverse the list of keys twice), but certainly very obvious and clear.
UPDATE: I didn’t realize your keys were strings. Since it sounds as if that was a mistake, I’ll let this stand as is, but do note that it requires keys to be actual integers.