Compsci 6, Fall 2011, Classwork 17

PRINT Names and NetID of students in group (min 2, max 3)
Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Problem 1:

d = {'duke':30, 'unc':50, 'ncsu':40} print "d.values()", d.values() print "d.keys()", d.keys() d['duke'] = 80 d.update({'ecu':40, 'uncc':70}) print "d.values()", d.values()

Problem 2:

Assume d is the resulting dictionary from above. What is the difference between these 3? print "d.items()", d.items() print "d.iteritems()", d.iteritems() print "d", d

Problem 3:

Using the dictionary from above, how many schools have more than 40 attendees?

Problem 4:

Using the dictionary from above, which schools have more than 40 attendees?

Problem 5:

Create a new dictionary from d that can easily answer questions such as, which schools have X attendees.

Problem 6:

Create a dictionary of popular song titles and how many times each song is 1st place, 2cd place, 3rd place... see songtitles.py