Outline for April 3, 2009

Reading: §2.1–2.3


  1. Software development
    1. Analyze the problem
    2. Determine specifications
    3. Create a design
    4. Implement the design
    5. Test/debug the program
    6. Maintain the program
  2. Example: program to convert temperature
    1. Do we go from Fahrenheit to Celsius, Celsius to Fahrenheit, or both?
    2. Go from Celsius to Fahrenheit
    3. Steps in the program:
      1. Ask user for temperature in Celsius
      2. Convert to Fahrenheit (using well-known formula)
      3. Print result in Fahrenheit
    4. Implementation: see tempcvt.py
  3. Example: sum of first n numbers
    1. Do we include n or not?
    2. Begin at 1, add numbers up to and including n
    3. Steps in the program:
      1. Initialize total to 0
      2. Ask user for number
      3. Count from 1 up to number
        1. Add each number to total
      4. Print results
    4. Implementation:see sum.py
    5. It doesn’t work—show how to debug it (see sum2.py for working version)
  4. Variables
    1. What they are
    2. Names, identifiers
    3. Legal, illegal names
    4. Reserved words
  5. Expressions
    1. Operation, operand
    2. Operators +, −, *, /, %, **
    3. Name Errors