generated from mwc/lab_weather
I was able to write code that prints a weather forecast to my liking.
I used some code from older functions to help me write the newer program. All these systems involve using named arguments to run certain actions.
This commit is contained in:
@@ -21,4 +21,15 @@ 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)
|
||||
|
||||
for day in forecast:
|
||||
display = day["name"] + " Temperature: " + str(day["temperature"]) + " Wind Speed: " + str(day["wind_speed"]) + " Weather: " + day["description"]
|
||||
print(display)
|
||||
Reference in New Issue
Block a user