From f8a089f6e60aba10ab54a61cd57bcb2a2d75e001 Mon Sep 17 00:00:00 2001 From: Hope Date: Mon, 7 Jul 2025 21:07:00 -0400 Subject: [PATCH] completed the last function. I had to use AI for help on syntax for adding to a count. --- friend_functions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/friend_functions.py b/friend_functions.py index 20653e4..e207daf 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -84,7 +84,14 @@ def get_color_dict(people): "orange": 1, } """ - raise NotImplementedError() + fav_color_dict = {} + for person in people: + for color in person.get("favorite_colors", []): + if color in fav_color_dict: + fav_color_dict[color] += 1 + else: + fav_color_dict[color] = 1 + return fav_color_dict