diff --git a/friend_functions.py b/friend_functions.py index 6f5ecf7..1f82ae3 100644 --- a/friend_functions.py +++ b/friend_functions.py @@ -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 person["name"] == 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. @@ -37,7 +41,10 @@ def count_favorite_colors(people, name): >>> count_favorite_colors(family, "Raphael Chambers") 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): """Returns a list containing only those people who like the given color. diff --git a/weather/forcast_return b/weather/forcast_return new file mode 100644 index 0000000..e69de29 diff --git a/weather/weather.py b/weather/weather.py index 75fd2f6..5fb4cb0 100644 --- a/weather/weather.py +++ b/weather/weather.py @@ -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 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) + + + + +