Boston Python workshop 2/Friday tutorial: Difference between revisions

Line 428:
</pre>
 
So what is going on here? When Python encounters the <code>if</code> keyword, it <i>evaluates</i> the <i>expression</i> following the keyword and before the colon. If that expression is <b>True</b>, Python executes the code in the indented code block under the <code>if</code> line. If that expression is <b>False</b>, Python skips over the code block:.
 
In this case, because <code>1</code> is truthy, Python executes the code block under the if statement, and we see "1 is truthy" printed to the screen.
 
 
What about a 0? Is it truthy?
 
<pre>
Anonymous user