title: Checking a value falls between three ranges in Python
body: <p>I am currently learning Python and want to ensure I am using good python practices and need some help in finding the best way of checking whether a value falls between different ranges.</p>
  
  <p>Basically I am trying to find whether a cpu utilization is between 0-33 (green), 34-66 (amber) or 67-100 (red).  Here's my current code;</p>
  
  <pre><code>green = 33
  amber = 66
  red   = 100  # Probably not needed, but there for completeness
  
  if cpu &lt;= green:
     print "green"
  elif cpu &gt; amber:
     print "red"
  else:
     print "amber"
  </code></pre>
  
  <p>Is there a better way to achieve this in Python?</p>
  
  <p>I've looked at "Interval Comparisons" and that doesn't seem to quite fit the bill - although it is entirely possible that I haven't understood them correctly.</p>
  
  <p>Any help is greatly appreciated.</p>