lec-10-30

lec-10-30 - New Assignment Two weeks long Hand in first...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ECS 10 10/30 New Assignment ± Two weeks long ± Hand in first part Nov. 3, complete version Nov. 10. Also extra credit part ± Also extra credit part. ± You may work in teams of two. Both hand in same program. ± If working in a pair, work together in same room. Make sure you both understand the program completely. ± Basis of second midterm. Energy Use Map Coal used per capita. Dictionary ± Initialize the empty dictionary: popDict = {} ± Add values, use key as "index" popDict[stateName] = population ± Test if key is in dictionary if stateName in popDict ± Look up values using key as "index" population = popDict[stateName] Database program structure ± First main loop: Build dictionary containing data ± Second main loop: Ask user for queries, look up answers More than one thing per item ± Example: Database of used cars. We would want price, but also year, condition, color… ± Key is still the name of the car. ± ± Dictionary where values are lists!
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

lec-10-30 - New Assignment Two weeks long Hand in first...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online