This commit is contained in:
lfitchlee
2025-11-07 09:23:15 -05:00
parent 452ddff23d
commit c3f9cd7fca
3 changed files with 27 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ def count_people(people):
>>> count_people(friends) >>> count_people(friends)
10 10
""" """
raise NotImplementedError() return len(people)
def get_email(people, name): def get_email(people, name):
"""Returns the named person's email address. If there is no such person, returns None. """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") >>> get_email(friends, "Tad Winters")
None None
""" """
raise NotImplementedError() for person in people:
if person["name"] == name:
return person["email"]
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.
@@ -37,7 +41,10 @@ def count_favorite_colors(people, name):
>>> count_favorite_colors(family, "Raphael Chambers") >>> count_favorite_colors(family, "Raphael Chambers")
1 1
""" """
raise NotImplementedError() for person in people:
if person["name"] == name:
return len(person["favorite_colors"])
return None
def people_who_like_color(people, color): def people_who_like_color(people, color):
"""Returns a list containing only those people who like the given color. """Returns a list containing only those people who like the given color.

0
weather/forcast_return Normal file
View File

View File

@@ -21,4 +21,20 @@ def print_weather(location=None, metric=False, verbose=False):
When metric is True, prints out the weather in metric units. When metric is True, prints out the weather in metric units.
When verbose is True, prints out a more detailed report. When verbose is True, prints out a more detailed report.
""" """
print("Not finished...") # YOUR CODE HERE! if location:
coordinates = geocode_location(location)
else:
coordinates = estimate_location()
office = get_weather_office(coordinates["lat"], coordinates["lng"])
forecast = get_forecast(office["office"], office["x"], office["y"], metric=metric)
#print(forecast) # YOUR CODE HERE!
for day in forecast:
display = day["name"] +":"+ day["description"] + " with a high of " + str(day["temperature"]) + "."
print(display)