Jump to content

Boston Python Workshop 3/Friday/Tutorial: Difference between revisions

imported>Jesstess
imported>Jesstess
Line 486:
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>True</code> is truthy, Python executes the code block under the if statement, and we see "I'm True!" printed to the screen. WhatGuess do you thinkwhat will happen with these? Tryother expressions, then type them out and see if your guess was correct:
 
<pre>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.