logo CodeStepByStep logo


Language/Type: Python collections dict

What keys and values are contained in the following dictionary after this code executes?

people = {}
people[7] = "Marty"
people[34] = "Louann"
people[27] = "Donald"
people[15] = "Moshe"
people[84] = "Larry"
people[7] = "Ed"
people[2350] = "Orlando"
del people[7]
people[5] = "Moshe"
del people[84]
people[17] = "Steve"

(Though dictionaries store their contents in unpredictable order, for this problem, write the pairs sorted by numeric value of the keys, in the format {key: 'value', key: 'value'}.)

dictionary contents

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.