How are conditional statements with multiple conditions evaluated?
<p>I'd expect the following two code blocks to be evaluated the same way, but it would seem that is not the case.</p>

<pre><code>if True or False and False:
    print('True')                                                               
else:                                                                           
    print('False')
</code></pre>

<p>True is printed</p>

<pre><code>if (True or False) and False:
    print('True')
else:                                                                           
    print('False')
</code></pre>

<p>False is printed           </p>

<p>Here's my breakdown of the logic:</p>

<p>True or False => True</p>

<p>True and False => False</p>

<p>By substitution, (True or False) and False => True and False => False                                                                                                  </p>

<p>Why does this happen? </p>

<p>Standard Order of operations gives <code>and</code> precedence over <code>or</code>, so the first statement  <code>True or False and False</code> is logically equivalent to </p>

<pre><code>True or (False and False)
</code></pre>

<p>This evaluates to <code>True</code>.</p>

<p>The second statement is </p>

<pre><code>(True or False) and False
</code></pre>

<p>This evaluates to <code>False</code>.</p>

python