How does and&or work in print() function? : <p>Saw this while searching and I couldn't understand the logic behind. How does and &amp; or methods work in print()?</p>

<pre class="lang-py prettyprint-override"><code>T=[int(s) for s in input().split()]
print(T and sorted(sorted(T,reverse=True),key=abs)[0] or 0)
</code></pre>

<p>I've tried simplifying it to understand how it handles different inputs.</p>

<pre class="lang-py prettyprint-override"><code>print(A and B or C)
</code></pre>

<p>Returns B when B is not 0, and returns C when B is 0 but never gets to A.</p>
