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:
kdang
2025-11-07 09:24:40 -05:00
parent 78da86d231
commit 4eb17103c6
2 changed files with 28 additions and 6 deletions

View File

@@ -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)