Boston Python workshop 2/Friday tutorial: Difference between revisions

 
Line 516:
print "brother is older"
</pre>
 
Like with <code>if</code>, the code block under the <code>else</code> statement must be indented.
 
You can check multiple expressions together using the <code>and</code> and <code>or</code> keywords. If two expressions are joined by an <code>and</code>, they <b>both</b> have to be True for the overall expression to be True. If two expressions are joined by an <code>or</code>, as long as <b>one</b> is True, the overall expression is True.
Line 533 ⟶ 535:
<pre>
1 <= 0 or "a" not in "abc"
</pre>
 
<pre>
temperature = 32
if temperature > 60 and temperature < 75:
print "It's nice and cozy in here!"
else:
print "Too extreme for me."
</pre>
 
Anonymous user