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.

Function: Write a Python function as described, not a complete program.

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.