generated from mwc/lab_weather
I started with if verbose and tried to think how to show less information. I used else and use the first item in the list, which is today's weather, only.
The three systems having commonality in the way they transfer data between each other using list and dictionary.
This commit is contained in:
parent
da71a110e4
commit
ba85b536e3
|
@ -21,4 +21,27 @@ 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 verbose:
|
||||
print(location)
|
||||
if location is None:
|
||||
mylocation=estimate_location()
|
||||
else:
|
||||
mylocation=geocode_location(location)
|
||||
if mylocation is None:
|
||||
print("Your City Cannot Be Found")
|
||||
return
|
||||
if verbose:
|
||||
print(mylocation)
|
||||
myoffice=get_weather_office(mylocation['lat'], mylocation['lng'])
|
||||
if myoffice is None:
|
||||
print("There is no weather station")
|
||||
return
|
||||
if verbose:
|
||||
print(myoffice)
|
||||
myforcast=get_forecast(myoffice["office"],myoffice["x"],myoffice["y"], metric)
|
||||
if verbose:
|
||||
print(myforcast)
|
||||
else:
|
||||
print(myforcast[0])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue