made change to fix else/return None problem

I removed the
else:
    return None
and replaced with
return None

as discussed on Discord. I checked the code with test_friend_functions.py
and it all still works.
This commit is contained in:
Chris Mekelburg 2024-10-20 20:18:55 -04:00
parent bd5373efd9
commit 8c678d274a
1 changed files with 2 additions and 4 deletions

View File

@ -30,8 +30,7 @@ def get_email(people, name):
for person in people: for person in people:
if person["name"] == name: if person["name"] == name:
return person["email"] return person["email"]
else: return None
return None
def count_favorite_colors(people, name): def count_favorite_colors(people, name):
"""Returns the number of colors liked by the named person. If there is no such person, returns None. """Returns the number of colors liked by the named person. If there is no such person, returns None.
@ -45,8 +44,7 @@ def count_favorite_colors(people, name):
if person["name"]== name: if person["name"]== name:
colors = person["favorite_colors"] colors = person["favorite_colors"]
return len(colors) return len(colors)
else: return None
return None