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.
This commit is contained in:
root 2024-10-13 21:13:40 -04:00
parent 077aa7070a
commit 9bc09ed4db
1 changed files with 5 additions and 2 deletions

View File

@ -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.