diff --git a/.DS_Store b/.DS_Store index 6e2b167..8d2981c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/weather/.DS_Store b/weather/.DS_Store new file mode 100644 index 0000000..1a6d042 Binary files /dev/null and b/weather/.DS_Store differ diff --git a/weather/weather.py b/weather/weather.py index 75fd2f6..3dd12a8 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! + + coords = estimate_location() if location is None else geocode_location(location) + if not coords: + return print("Cannot determine location.") + + office = get_weather_office(**coords) + if not office: + return print("Cannot determine NWS office.") + + weather = get_forecast(**(office | {'metric': metric})) + if not weather: + return print("Forecast cannot be found.") + + print(f"Today will be {weather[0]["description"].lower()} with an average temperature of {weather[0]["temperature"]}°{"C" if metric else "F"}.") + if verbose: + print(f"Winds headed {weather[0]["wind_direction"]} at {weather[0]["wind_speed"]}.") +