# friend_functions.py # ------------ # By MWC Contributors # # Each of the functions below expects a list of dictionaries as its first # argument. Two examples of the expected input are provided in people.family # and people.friends. # Your job is to complete these functions. Remove the NotImplementedError from # each and instead write code which returns the expected values. def count_people(people): count=0 for person in people: if "name" in person: count=count+1 print(count) def get_email(people, name): email="" for person in people: if person["name"] == name: email=person["email"] print(f'"{email}"') return else: print("None") def count_favorite_colors(people, name): for person in people: if person["name"] == name: numcolor=len(person["favorite_colors"]) print(numcolor) return else: print("None") def people_who_like_color(people, color): for person in people: if color in person["favorite_colors"]: print(person) else: print([]) def count_people_who_like_color(people, color): colorcount=0 for person in people: if color in person["favorite_colors"]: colorcount=colorcount+1 print(colorcount) def get_color_dict(people): """Returns a dict showing how many people like each color. Any color liked by any of the people will be included, and only colors liked by someone will be included. The order of items in the dict doesn't matter. >>> get_color_dict(family) { "aqua": 2, "red": 2, "blue": 2, "black": 2, "white": 1, "grey": 1, "yellow": 2, "orange": 1, } """ raise NotImplementedError()