This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Announcements ECS 10
10/29 Assignment Assignment 4 due tonight. Midterm Midterm scores on myUCDavis. myUCDavis. Midterm Midterm curve: 17 or better, A 14 or better, B 11 or better, C 8 or better, D Median Median grade: Last Last time: files
Program Program to cut article into sentences while loop to read file put all words in file into a list for loop to output sentences read list of word when we see a period, output sentence Structure of program
Very Very typical program structure: while loop to read file put some data into a data structure loop to do something with data remove data from data structure produce some output Another example
Program Program that answers questions based on data.
Select your Congressional district: 1 Mike Thompson is the Representative from District 1 Questions Questions known as queries. queries. Different Different data structures for different kinds of queries. Getting just the name
Often Often you don’t want all the data. Use Use your string processing skills! Here Here a line is: District 0 Mike Thompson …. District 24 Howard P. "Buck" Mckeon We We want the words in positions 2-the end 2- 1 Making a list of names
repList = ‘Mike Thompson’ Just Just concatenate each new name onto the list. Index Index in list will be number of district which that person represents. repList = repList + [name] concatenation list of length 1, containing name. 2 ...
View Full Document
- Winter '07