logo CodeStepByStep logo

dict_concepts

Language/Type: Python collections dict

Answer the following questions about dictionaries:

How do you examine every key and every value of a dictionary?
(order shuffled)
How do you check whether a given key is found in a dictionary in your code?
(order shuffled)
What happens if you try to add a key/value pair to a dictionary and it already has a pair with that same key?
(order shuffled)
What happens if you try to add a key/value pair to a dictionary and it already has a pair with the same value, but not with the same key?
(order shuffled)
The key/value pairs in a dictionary are stored in an unpredictable order. How can you loop over the pairs in sorted order by the ordering of the keys?
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.