We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents abd59b9 + 23682c6 commit 66b43b3Copy full SHA for 66b43b3
weatherAppPython
@@ -0,0 +1,16 @@
1
+import requests
2
+
3
+api_key = "your_api_key"
4
+city = input("Enter the city name: ")
5
6
+url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
7
+response = requests.get(url)
8
+data = response.json()
9
10
+if data["cod"] == 200:
11
+ weather = data["weather"][0]["description"]
12
+ temperature = data["main"]["temp"]
13
+ print(f"Weather in {city}: {weather}")
14
+ print(f"Temperature: {temperature}°C")
15
+else:
16
+ print("City not found.")
0 commit comments