diff --git a/weather/weather.py b/weather/weather.py index 75fd2f6..2853d29 100644 --- a/weather/weather.py +++ b/weather/weather.py @@ -21,4 +21,28 @@ 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: + lct = geocode_location(location) + show_lct =location + else: + lct = estimate_location() + show_lct = "Estimate location" + weatheroffice = get_weather_office(lct['lat'],lct['lng']) + if not weatheroffice: + print("Unable to find weather office data") + forecast = get_forecast(weatheroffice['office'],weatheroffice['x'],weatheroffice['y'], metric = metric) + if not forecast: + print('Unable to find forecast data') + print(f"Location: {show_lct if location else estimate_location()}\n ______________ \n") + for period in forecast: + print(f"{period['name']}") + print(f"Description: {period['description']}") + print(f"Temperature: {period['temperature']}{'C' if metric else 'F'}") + if verbose: + print(f"Wind Direction: {period['wind_direction']}") + print(f"Wind Speed: {period['wind _speed']}\n") + + + # print("Not finished...") # YOUR CODE HERE! + # print(location)