generate functionFri, 27 Jan 2023

создать фаил ворд и сохранить в него погоду в москве C:\Users\rybikov\PycharmProjects\pythonProject2\venv\Scripts\python.exe C:\Users\rybikov\PycharmProjects\pythonProject2\main.py Traceback (most recent call last): File "C:\Users\rybikov\PycharmProjects\pythonProject2\main.py", line 1, in <module> import requests ModuleNotFoundError: No module named 'requests'

import requests def get_weather(city): url = "http://api.openweathermap.org/data/2.5/weather" params = {"q": city, "units": "metric", "appid": "e9185b28e9969fb7a300801eb026de9c"} result = requests.get(url, params=params) print(result.status_code) print(result.headers["Content-Type"]) print(result.url) print(result.json()) return result.json() city = input("city") weather = get_weather(city) def get_temp(weather): temp = weather["main"]["temp"] return temp def get_wind(weather): wind = weather["wind"]["speed"] return wind def get_humidity(weather): humidity = weather["main"]["humidity"] return humidity data

Questions about programming?Chat with your personal AI assistant