Outline for November 19, 2012

Reading: § 7, 14
Assignment Due: Wednesday, November 28, 2012 at 5:00 PM


  1. Example use: linear search [linsearch.py]
  2. Example use: recursive linear search [rlinsearch.py]
  3. Example use: linear search using L.index(x) [linsearchix.py]
  4. Tuples
    1. Used to group data
    2. Like lists, but immutable
  5. Overview of top-down design
    1. Sometimes called “stepwise refinement”
    2. Break problem into smaller pieces, plus the “glue” to hold them together
    3. Do the glue first, with the smaller parts being stubs
    4. Do the stubs
  6. Step 1: the program, at a high level
    1. Play rock, paper, scissors against the computer
    2. Define goal, being specific
    3. Define input
    4. Define high-level design
  7. Step 2: Data representation, smaller pieces, and main program
    1. Define the routines as stubs
    2. Do main, directly from the design
  8. Step 3: First routine, who wins
    1. Test it with the main [rps-prog1.py]
  9. Step 4: Second routine, computer picks
    1. Be sure to print the result; useful later on, so a separate routine
    2. Again, test it with main [rps-prog2.py]
  10. Step 5: Third routine, user picks
    1. Check for errors on entry, and announce results
    2. Again, test it with main [rps-prog3.py]

A PDF version is available here.
ECS 10, Basic Concepts of Computing
Fall Quarter 2012