title: Elegant way to check if a float is between two numbers in Python?
body: <p>How do I check if x is between a and b?</p>
  
  <pre><code>a = 9
  b = 7
  x = 7.5
  </code></pre>
  
  <p>I came up with this:</p>
  
  <pre><code>a &lt; x &lt; b or b &lt; x &lt; a
  </code></pre>
  
  <p>It seems to do the job from a few tests I made, but it looks unreadable and confusing. Any other better way?</p>