title: Checking the range from dictionary values
body: <pre><code>valid = {'Temp': [10, 55], 'rain_percent': [40, 90]}
  Temp = 30.3
  Raining = 86. 88
  if int(Temp) not in range(valid['Temp'][0], valid['Temp'][1]):
      print "Bad Temp readings"
  if int(Raining) not in range(valid['rain_percent'][0], valid['rain_percent'][1]):
      print "Bad Rain Percentage readings"
  </code></pre>
  
  <p>This is how I'm checking if variables <code>Temp</code>, <code>Raining</code> are within the range of values of respective <code>keys</code> within my <code>valid</code> dictionary. But the problem here is I have to hardcode it using <code>valid['Temp'][0]</code>, <code>valid['Temp'][1]</code> with indices <code>0</code> and <code>1</code>. I know that in python you should never hardcode any indices till there's no option without doing so. Is there any better way of achieving the same output without hard-coding indices?</p>