PyCon intro tutorial/Python scripts

Practice reading and running Python files
(Estimated completion time: 15 - 30 minutes)

We'll be practicing two skills with this goal. The first is reading and understanding Python programs. The second is running these programs from the terminal.

For each of the following Python programs (folks often call these "scripts"), please do the following:

 Download the script and save it to your Desktop. Be sure to save it as a  file. Open the script in your text editor. Read through the script. Don't worry about understanding every last detail. Instead focus on:

 Overall, what does this script do? What variables and data types are used? Where are the strings, integers, and floats? What functions are used, and why? Where are the comments, and what do they tell you?  </li> Once you have a good sense of what the script does, it's time to run it! To run the program: <ol> open a terminal</li> use,  , and   (or on Windows,   and  ) to navigate to the directory where you saved the script</li> type, and then a space, and then the name of the file, and then press enter. For example:. That command tells Python to execute the contents of the file.</li> Does the script do what you expected?</li> </ol> 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>

Here are you scripts to read and run. Have fun with them!


 * nobel.py (this is the script we analyzed in the video)
 * tip_calculator.py
 * pizza_calculator.py

Success!
You've read and written your first Python scripts. Keep practicing!