CS21 In Class: week 8

Top-down design, file I/O, lists of lists (2D lists)

Setting up a subdirectory for week 8 in-class work

cd into your cs21/class/ subdirectory and create a new directory named 'week08', then cd into that directory:
$ cd cs21/class                     # cd into your cs21/class subdirectory
$ pwd	          

$ mkdir week08                      # make a subdirectory named week08   
$ cd week08                         # cd into it
$ pwd           

Now copy over all the files from my public/cs21/week08 directory into your week08 directory (remember to add the dot as the destination of the cp command). From your week08 directory:

$ cp ~newhall/public/cs21/week08/* .

Weekly In-class Examples

This week we are going to continue with Top-Down Design, and also look at file I/O and lists of lists (2-dimensional lists).

  1. We will look at some examples of reading in values from a file. Open filetest.py to see three different ways to read in values from a file. Here is some more information about file I/O

  2. Together we are going to write a large program, but applying Top-Down Design to determine how to structure our program, implementing fuction stubs, and iteratively implmenting and testing functions. This is the same process you will follow in solving Lab 7.

  3. Just as a reminder, listOps.py and stringOps.py have some examples of converting lists to strings and strings to lists, and of str and list methods. Here is some more information about str and list

  4. We will revisit nested loops, and use them to solve a pattern of stars problem with some restrictions (one of the board challenge problems from quiz 3).

  5. We will look at some examples of lists of lists and how to access elements in 2-D lists.