Editing Community Data Science Workshops (Fall 2014)/Day 0 tutorial
From CommunityData
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 7: | Line 7: | ||
a = "Hello" | a = "Hello" | ||
you should type the expression at a | you should type the expression at a Python prompt, hitting Return after every line and noting the output. | ||
No copying and pasting! You'll learn the concepts better if you type them out yourself. | No copying and pasting! You'll learn the concepts better if you type them out yourself. | ||
Line 224: | Line 224: | ||
len("Hello") | len("Hello") | ||
len("") | len("") | ||
fish = " | fish = "humuhumunukunukuapuaʻa" | ||
name_length = len(fish) | name_length = len(fish) | ||
fish + " is a Hawaiian fish whose name is " + str(name_length) + " characters long." | fish + " is a Hawaiian fish whose name is " + str(name_length) + " characters long." | ||
Line 325: | Line 325: | ||
<ol> | <ol> | ||
<li>Download the file http://mako.cc/teaching/2014/cdsw/nobel.py by right-clicking on it and saying to save it as a ".py" file to your Desktop. The ".py" extension hints that this is a Python script.</li> | <li>Download the file http://mako.cc/teaching/2014/cdsw/nobel.py by right-clicking on it and saying to save it as a ".py" file to your Desktop. The ".py" extension hints that this is a Python script.</li> | ||
<li>Open a terminal prompt, and use the navigation commands (<code>dir</code> and <code>cd</code> on Windows, <code>ls</code>, <code>pwd</code>, and <code>cd</code> on OS X and Linux) to navigate to your Desktop directory. See [[ | <li>Open a terminal prompt, and use the navigation commands (<code>dir</code> and <code>cd</code> on Windows, <code>ls</code>, <code>pwd</code>, and <code>cd</code> on OS X and Linux) to navigate to your Desktop directory. See [[Boston Python Workshop 8/Friday#Goal_.234:_practice_navigating_the_computer_from_a_terminal|navigating from a terminal]] for a refresher on those commands.</li> | ||
<li>Once you are in your Desktop directory, execute the contents of <code>nobel.py</code> by typing | <li>Once you are in your Desktop directory, execute the contents of <code>nobel.py</code> by typing | ||
Line 334: | Line 334: | ||
<code>nobel.py</code> introduces two new concepts: comments and multiline strings.</li> | <code>nobel.py</code> introduces two new concepts: comments and multiline strings.</li> | ||
<li>Open <code>nobel.py</code> in your text editor (see [[ | <li>Open <code>nobel.py</code> in your text editor (see [[Boston Python Workshop 8/Friday#Goal_.232:_prepare_a_text_editor|preparing your text editor]] for a refresher on starting the editor).</li> | ||
<li>Read through the file in your text editor carefully and check your understanding of both the comments and the code.</li> | <li>Read through the file in your text editor carefully and check your understanding of both the comments and the code.</li> | ||
</ol> | </ol> |