Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_person_with_most_hobbies(file):
- """
- Find the person (or people) who have more hobbies than others.
- :param file: original file path
- :return: list
- """
- d = create_dictionary(file)
- max_hobbies = 0
- person_with_most_hobbies = []
- for names, hobbies in d.items():
- if len(hobbies) > max_hobbies:
- max_hobbies = len(hobbies)
- person_with_most_hobbies = [names]
- elif len(hobbies) is max_hobbies:
- person_with_most_hobbies.append(names)
- return person_with_most_hobbies
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement