Advertisement
UniQuet0p1

Untitled

Sep 28th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. def find_person_with_most_hobbies(file):
  2. """
  3. Find the person (or people) who have more hobbies than others.
  4.  
  5. :param file: original file path
  6. :return: list
  7. """
  8. d = create_dictionary(file)
  9. max_hobbies = 0
  10. person_with_most_hobbies = []
  11. for names, hobbies in d.items():
  12. if len(hobbies) > max_hobbies:
  13. max_hobbies = len(hobbies)
  14. person_with_most_hobbies = [names]
  15. elif len(hobbies) is max_hobbies:
  16. person_with_most_hobbies.append(names)
  17. return person_with_most_hobbies
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement