Computer Science 111a - Fall Semester, 2006
Homework #7 (also serves as Lab7)
due: by midnight Tuesday October 24, 2006

Your task in this week's project is to use a file as a database. You'll read in the contents, a list of book titles, and allow the user to add more, sort the file in lexicographic (alphabetical) order, then write the whole thing back out to the same file. For now we will use a simple although inefficient sorting algorithm, and will return to more efficient sorts later in the semester.

Work one step at a time, getting each step to work before moving on:

Note 1: when debugging, examine your file books.dat. If it has strange data in it, delete it and put the old data back in, or just do

getcopy books.dat
to overwrite your incorrect one.
Note 2: In all the homeworks from now on, including this one, you must provide documentation for all functions. i.e. Just before the function definition, include a banner, in comments, that says the function name, what it takes for parameters and what it returns, and what task it performs.
Note 3: I placed a plain
print
statement before each call to printList() in my main() definition to separate each time the list of books is printing.

What to submit. Your program should be in a file called hw7.py. Submit this homework by the due date with the command submit homework7 hw7.py