logo CodeStepByStep logo

has_duplicate_value

Language/Type: Python dict collections

Write a function named has_duplicate_value that accepts a dictionary from strings to strings as a parameter and returns True if any two keys map to the same value. For example, if a dictionary named m stores {'Marty': 'Stepp', 'Stuart': 'Reges', 'Jessica': 'Miller', 'Amanda': 'Camp', 'Meghan': 'Miller', 'Hal': 'Perkins'}, the call of has_duplicate_value(m) would return True because both 'Jessica' and 'Meghan' map to the value 'Miller'. Return False if passed an empty or one-element dictionary. Do not modify the dictionary passed in.

Type your Python solution code here:

This is a function exercise. Write a Python function as described. Do not write a complete program; just the function(s) above.

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.