Boston Python workshop 2/Friday tutorial: Difference between revisions

no edit summary
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
Line 324:
the code.
 
==Practice==
 
Read the following expressions, but don't execute them. Guess what the output will be. After you've made a guess, copy and paste the expressions at a Python prompt and check your guess.
will be. After you've made a guess, copy and paste the expressions at a Python
prompt and check your guess.
 
1.
<pre>
total = 1.5 - 1/2 + ((-2.0/2) - (1.0/2))
print total
type(total)
</pre>
 
2.
<pre>
a = "quick"
b = "brown"
c = "fox jumps over the lazy dog"
print "The", a * 3, b * 3, c
</pre>
 
3.
<pre>
print 2.0 * 123, "2.0" * 123
print 2.0 * 123 + str(2.0) * 123
</pre>
 
4.
<pre>
a = "| (_| -()- -()- -()- -()- | -()- -()- -()- -()- ||\n"
b = "|_\_|_/___|__|__|__|___|__|___|__|___________________________||\n"
Line 360 ⟶ 365:
 
print d + f + i + e + b + g + a + c + l + h + j + k
</pre>
Anonymous user