Created the first two functions where you are counting the number of people - here you use the len command to count the number of people. For the second function returned the named persons email address by using a for loop statment to help.

This commit is contained in:
erbrown
2025-12-13 20:27:09 -05:00
parent 280df8324a
commit ba8f01aabc
2 changed files with 64 additions and 60 deletions

View File

@@ -17,7 +17,7 @@ def count_people(people):
>>> count_people(friends)
10
"""
raise NotImplementedError()
return len(people)
def get_email(people, name):
"""Returns the named person's email address. If there is no such person, returns None.
@@ -27,7 +27,11 @@ def get_email(people, name):
>>> get_email(friends, "Tad Winters")
None
"""
raise NotImplementedError()
for person in people:
if name == person['name']:
return(person['email'])
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.