logo CodeStepByStep logo

has_three

Language/Type: Python dict collections

Write a function named has_three that accepts a list of strings as a parameter and returns True if any string value occurs at least 3 times in the list. For example, in the list ["to", "be", "or", "be", "to", "be", "hamlet"], the word "be" occurs 3 times, so your function would return True if passed that list. Use a dict as auxiliary storage to help solve the problem. Do not modify the list that is 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.