from pprint import pprint
import json

#wczytanie danych z pliku pogoda.json
with open("pogoda.json", "r") as file:
    data = json.load(file)

#pobranie miasta od uzytkownika
city = input("wpisz nazwe miasta ")

#szukanie pogody w danym miescie
city_waether = None
for item in data['city weather']:
    if item['city'] == city:
        city_waether = item
        break

#wyswietlanie wynikow
if city_waether:
    print(f"Pogoda w {city_waether['city']}:")
    print(f"temperatura: {city_waether['temperature']}*0:")
    print(f"wilgotnosc: {city_waether['humidity']}%")
    print(f"stan pogody: {city_waether['weather']}")
    print(f"predkosc wiatru: {city_waether['wind speed']}km/h")
    print(f"opis: {city_waether['description']}")
else:
    print("nie znaleziono informacji o pogodzie w tym miescie.")
    