From 1631f4744523d9240126f22880c936c78de3fab6 Mon Sep 17 00:00:00 2001 From: Chris Mekelburg Date: Sun, 13 Oct 2024 15:13:56 -0400 Subject: [PATCH] Function 3 count_favorite_colors Not sure what is going on here, but I was able to decipher the error message that it is not reading 0 for when the "favorite colors" list is empty. I'm just not sure what it is not reading 0 and I've tried a few other things too with the same result. Going to move on for now and come back to this later. --- friend_functions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/friend_functions.py b/friend_functions.py index aabdbaa..1e7535b 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -41,7 +41,13 @@ def count_favorite_colors(people, name): >>> count_favorite_colors(family, "Raphael Chambers") 1 """ - raise NotImplementedError() + for person in people: + if person["name"]== name: + colors = (person["favorite_colors"]) + return len(colors) + + else: + return "None" def people_who_like_color(people, color): """Returns a list containing only those people who like the given color.