Boston Python workshop 2/Friday tutorial: Difference between revisions

Content added Content deleted
No edit summary
Line 325: Line 325:
<li>Read through the file in your text editor carefully and check your understanding of both the comments and the code.</li>
<li>Read through the file in your text editor carefully and check your understanding of both the comments and the code.</li>
</ol>
</ol>

==Booleans==

<pre>
True
</pre>

<pre>
type(True)
</pre>

<pre>
False
</pre>

<pre>
type(False)
</pre>

<pre>
0 == 0
</pre>

<pre>
0 == 1
</pre>

<pre>
"H" in "Hello"
</pre>

<pre>
"X" in "Hello"
</pre>

==Flow Control==

<pre>
if 1:
print "1 is truthy"
</pre>

<pre>
if 0:
print "0 is truthy"
</pre>

<pre>
if "test":
print "non-empty strings are truthy"
</pre>

<pre>
if "":
print "empty strings are truthy"
</pre>


==Practice==
==Practice==