title: How does python evaluate A<X<B
body: <p>There is the code that I saw was this.</p>
  
  <p><code>def min(x,y,z):
     if z&lt;=x&lt;=y:
        return z
     elif x&lt;=y and x&lt;z:
        return x
     elif y&lt;=z and y&lt;=x:
        return y
  </code></p>
  
  <p>They ask the following if <code>z&lt;=x&lt;=y</code> is changed to the following <code>(z&lt;=x)&lt;=y</code> or <code>z&lt;=x and x&lt;=y</code> does it make a difference?</p>
  
  <p>Since I know that python always evaluate left to right base on order precedence, I would like to know if <code>(z&lt;=x)&lt;=y</code> is correct or not.</p>
  
  <p>I would like to also know about what happens if there is multiple and/or in a conditions such as:</p>
  
  <p>if <code>A and B or C</code> vs <code>A or B and C</code> vs <code>A and B or C and D</code>.</p>
  
  <p>Is it computed as <code>(A and B) or C</code> or <code>A and (B or C)</code>?</p>