From 55fdfc2c8d8a174738be43060d7166d22bc72ba2 Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer Date: Fri, 29 Sep 2023 13:25:31 +0200 Subject: [PATCH] Rename bad variable names --- openweather.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openweather.py b/openweather.py index a6eb108..d2e7099 100755 --- a/openweather.py +++ b/openweather.py @@ -13,16 +13,16 @@ base_url = "https://api.openweathermap.org/data/2.5/weather?" complete_url = base_url + "appid=" + api_key + "&q=" + city_name response = requests.get(complete_url) -x = response.json() +data = response.json() -if x["cod"] != "404": +if data["cod"] != "404": - y = x["main"] - current_temperature = y["temp"] - current_pressure = y["pressure"] - current_humidity = y["humidity"] - z = x["weather"] - weather_description = z[0]["description"] + info_main = data["main"] + info_weather = data["weather"] + current_temperature = info_main["temp"] + current_pressure = info_main["pressure"] + current_humidity = info_main["humidity"] + weather_description = info_weather[0]["description"] print() print(Columns([ @@ -40,4 +40,4 @@ if x["cod"] != "404": ])) else: - print(" City Not Found ") \ No newline at end of file + print(" City Not Found ")