Boston Python Workshop 4/ColorWall handout: Difference between revisions

no edit summary
imported>Jesstess
(Created page with '====Indentation reminder==== In Python, indentation matters. Everything is indented by a multiple of some number of spaces, often 4. In <code>if</code> statements, you indent e…')
 
imported>Jesstess
No edit summary
Line 45:
The <code>print</code> line is indented 4 spaces under the <code>for</code>. That's how
Python knows to execute the print line for every name in names.
 
====Range====
 
<pre>
>>> range(5)
[0, 1, 2, 3, 4]
>>> for i in range(5):
... print "Hi" * i
...
 
Hi
HiHi
HiHiHi
HiHiHiHi</pre>
Anonymous user