some help as I work thorugh weather.py

Submitting for some help on the weather.py file. It is not printing the
help for me nor letting me input a location with -h or -l as I mentioned
on Discord.
This commit is contained in:
Chris Mekelburg 2024-10-20 19:48:33 -04:00
parent 0a4b79f4c2
commit bd5373efd9
2 changed files with 19 additions and 3 deletions

View File

@ -8,7 +8,7 @@
#
# It's your job to implement this function.
from weather.weather_apis import (
from weather_apis import (
geocode_location,
estimate_location,
get_weather_office,
@ -21,4 +21,20 @@ 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 == None:
coordinates = estimate_location()
else:
coordinates = geocode_location(location)
office_info = get_weather_office(coordinates["lat"], coordinates["lng"])
office_only = office_info["office"]
all_forecasts = get_forecast(office_info["office"], office_info["x"], office_info["y"])
print(all_forecasts)
print()
print("The forecast for", office_only, "is")
for forecast in all_forecasts:
print(forecast["name"],"temperature of", forecast["temperature"], "wind speed of", forecast["wind_speed"], "out of the ", forecast["wind_direction"],"conditions of", forecast["description"]) # YOUR CODE HERE!
print()
print_weather()

View File

@ -9,7 +9,7 @@
# You don't need to do anything with thie file.
from argparse import ArgumentParser
from weather.weather import print_weather
from weather import print_weather
def weather_cli():
"""Provides a command-line interface for weather.