From 9bc09ed4db73bc3bfe565d373afb74bc710ffaad Mon Sep 17 00:00:00 2001 From: root Date: Sun, 13 Oct 2024 21:13:40 -0400 Subject: [PATCH] I got the get_email function to work. I am still using mainly list rules, I don't really get the iterate for dict yet. --- friend_functions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/friend_functions.py b/friend_functions.py index 9b75faf..938a785 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -22,7 +22,6 @@ def count_people(people): count = count + 1 return count - def get_email(people, name): """Returns the named person's email address. If there is no such person, returns None. @@ -31,7 +30,11 @@ def get_email(people, name): >>> get_email(friends, "Tad Winters") None """ - raise NotImplementedError() + for person in people: + if person["name"] == name: + return person["email"] + else: + return None def count_favorite_colors(people, name): """Returns the number of colors liked by the named person. If there is no such person, returns None.