generated from mwc/lab_weather
I was just checking that everything was submitted but I guess this wasn't.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# It's your job to implement this function.
|
||||
|
||||
from weather.weather_apis import (
|
||||
from weather.weather_apis import(
|
||||
geocode_location,
|
||||
estimate_location,
|
||||
get_weather_office,
|
||||
@@ -21,4 +21,16 @@ 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!
|
||||
#ask for location -> geocode location
|
||||
if location:
|
||||
coordinates = geocode_location(location)
|
||||
#if none -> estimate location
|
||||
else:
|
||||
coordinates = estimate_location()
|
||||
#coordinate -> get weather office -> get forecast
|
||||
office = get_weather_office(coordinates["lat"], coordinates["lng"])
|
||||
forecast = get_forecast(office["office"], office["x"], office["y"], metric=False)
|
||||
for entry in forecast:
|
||||
print(entry["name"], 'it will be', entry["temperature"], 'degrees and', entry["description"], 'with', entry["wind_speed"], entry["wind_direction"], 'winds.')
|
||||
|
||||
#'name': 'This Afternoon', 'temperature': 53, 'wind_speed': '6 mph', 'wind_direction': 'NW', 'description': 'Mostly Sunny'
|
||||
Reference in New Issue
Block a user