Anonymous user
Boston Python Workshop 4/ColorWall handout: Difference between revisions
Boston Python Workshop 4/ColorWall handout (view source)
Revision as of 03:11, 30 September 2011
, 12 years agono 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>
|