From ba85b536e3ff653300a2cbe332430e66b8ff3e33 Mon Sep 17 00:00:00 2001 From: Seoyeon Lee Date: Sat, 7 Dec 2024 00:53:38 -0500 Subject: [PATCH] I started with if verbose and tried to think how to show less information. I used else and use the first item in the list, which is today's weather, only. The three systems having commonality in the way they transfer data between each other using list and dictionary. --- weather/weather.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/weather/weather.py b/weather/weather.py index 75fd2f6..8ee95eb 100644 --- a/weather/weather.py +++ b/weather/weather.py @@ -21,4 +21,27 @@ 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 verbose: + print(location) + if location is None: + mylocation=estimate_location() + else: + mylocation=geocode_location(location) + if mylocation is None: + print("Your City Cannot Be Found") + return + if verbose: + print(mylocation) + myoffice=get_weather_office(mylocation['lat'], mylocation['lng']) + if myoffice is None: + print("There is no weather station") + return + if verbose: + print(myoffice) + myforcast=get_forecast(myoffice["office"],myoffice["x"],myoffice["y"], metric) + if verbose: + print(myforcast) + else: + print(myforcast[0]) + +