Boston Python Workshop 7/Friday/Tutorial: Difference between revisions

Content added Content deleted
imported>Jesstess
imported>Jesstess
Line 504: Line 504:
That was our first multi-line piece of code, and the way to enter it at a Python prompt is a little different. First, type the
That was our first multi-line piece of code, and the way to enter it at a Python prompt is a little different. First, type the


<code>if 6 > 5:</code>
<code> if 6 > 5:</code>


part, and hit enter. The next line will have
part, and hit enter. The next line will have


<code>...</code>
<code> ...</code>


as a prompt, instead of the usual <code>&gt;&gt;&gt;</code>. This is Python telling us that we are in the middle of a <b>code block</b>, and so long as we indent our code it should be a part of this code block.
as a prompt, instead of the usual <code>&gt;&gt;&gt;</code>. This is Python telling us that we are in the middle of a <b>code block</b>, and so long as we indent our code it should be a part of this code block.
Line 514: Line 514:
Enter 4 spaces, and then type
Enter 4 spaces, and then type


<code>print "Six is greater than five!"</code>
<code> print "Six is greater than five!"</code>


Hit enter to end the line, and hit enter again to tell Python you are done with this code block. All together, it will look like this:
Hit enter to end the line, and hit enter again to tell Python you are done with this code block. All together, it will look like this: