Please explain the output of this python code
<p>Here the code.</p>

<pre><code>a = False
if a == True or True:
   print "Hell yeah,I'm genius"
else:
   print "shit,I am a fool"
</code></pre>

<p>Output is '<code>Hell yeah,I'm genius</code>'</p>

<pre><code>a ==True or True 
</code></pre>

<p>Consider True is 1 and 0 is False.</p>

<p>Since a is set to False (a=False in first statement of code), the first part 'a==True' i.e.  0 ==1 will return 0 (False).</p>

<p>Then remaining will be False or True since 'a==True' is False.
So it will be like 0 or 1 (False or True).</p>

<p>We know that</p>

<ul>
<li>0 AND 0 = 0</li>
<li>1 AND 0 = 0</li>
<li>1 AND 1 = 1</li>
<li>0 OR 0 = 0   </li>
<li>0 OR 1 = 1   </li>
<li>1 OR 1 = 1</li>
</ul>

<p>So in your case, 0 OR 1 will result to 1 i.e. True. </p>

<p><strong>Summary :</strong></p>

<pre><code>a == True or True =&gt; False or True =&gt; True
</code></pre>

<p>That's why "Hell yeah,I'm genius" will be printed.</p>

python