Skillshare intro to Python/Unit 1: Difference between revisions

no edit summary
imported>Jesstess
imported>Jesstess
No edit summary
Line 24:
* [[Skillshare intro to Python/Unit 1/OSX terminal navigation|OS X]]
* [[Skillshare intro to Python/Unit 1/Linux terminal navigation|Linux]]
 
== Goal #4: practice reading and running Python files ==
 
We'll be practicing two skills with this goal. The first is <b>reading and understanding Python programs</b>. The second is <b>running these programs from the terminal</b>.
 
For each of the following Python programs (folks often call these "scripts"), please do the following:
 
<ol>
<li>Download the script and save it to your Desktop. Be sure to save it as a <code>.py</code> file.</li>
<li>Open the script in your text editor.</li>
<li>Read through the script. Don't worry about understanding every last detail. Instead focus on:
 
<ul>
<li>Overall, what does this script do?</li>
<li>What variables and data types are used? Where are the strings, integers, and floats?</li>
<li>What functions are used, and why?</li>
<li>Where are the comments, and what do they tell you?</li>
</ul>
</li>
<li>Once you have a good sense of what the script does, open a terminal, navigate to the directory where you saved the script, and run it. Does it do what you expected?</li>
<li>Think about one way that you could extend the script to make it more useful. How would you make that change in code?</li>
</ol>
 
<b>Here are you scripts to read and run</b>. Have fun with them!
 
* [http://web.mit.edu/jesstess/www/SkillsharePython/Unit1/nobel.py nobel.py] (this is the script we analyzed in the video)
* [http://web.mit.edu/jesstess/www/SkillsharePython/Unit1/tip_calculator.py tip_calculator.py]
* [http://web.mit.edu/jesstess/www/SkillsharePython/Unit1/pizza_calculator.py pizza_calculator.py]
Anonymous user