# Write a function called most_common_names that # takes a list of names and returns 2 things: # (1) the name that appears the most often, and # (2) the number of occurrence # # If there is a tie, return the first most common name and its occurrence # # remember: the order of the return is important # # hint: Lists have a function called .count(x) that returns # the number of times x appears in the list def most_common_names(names_list): max_count = 0 max_name = "" # running variable keeping track of the most occurrence name for name in names_list: if max_count < names_list.count(name): max_count = names_list.count(name) max_name = name return max_name, max_count print(most_common_names( ["Tom", "Mary", "Jeff", "Tom", "Jay", "Ann", "Paul", "Ann", "Ann", "Tom", "Mary", "Tom", "Jay"])) print(most_common_names(["Jim", "Mary", "Jeff", "Mary", "Jay", "Ann", "Paul", "Ann"]))