Python files

From OpenHatch wiki
Revision as of 15:27, 23 August 2013 by imported>Jesstess (Created page with " == Goal #1: practice reading and running Python files == (Estimated completion time: 15 - 30 minutes) We'll be practicing two skills with this goal. The first is <b>reading...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Goal #1: 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:

  1. Download the script and save it to your Desktop. Be sure to save it as a .py file.
  2. Open the script in your text editor.
  3. 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?
  4. 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?
  5. Think about one way that you could extend the script to make it more useful. How would you make that change in code?

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