generated from mwc/lab_weather
Checkpoint 2: Each system takes inputs, performs processsing and produces an output in return. The three different scales are composed of smaller components that work together to complete a specific task. It is really cool how everythiing works together to form a whole. Errors may arise within the three different scales that must be fixed in order for it to run properly.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user