Home / Projects / Weather Application
Day 8 · Day 8: Libraries & APIs

Weather Application

Build a command-line weather application that fetches current weather data for a city from a public weather API using the requests library and displays it in a readable format.

Requirements

1. Use the requests library to call a weather API (e.g., OpenWeatherMap) with an API key.
2. Ask the user to enter a city name.
3. Send a GET request with the city name and API key as parameters.
4. Parse the JSON response to extract temperature, weather description, and humidity.
5. Handle errors: invalid city name (404), network errors, and missing API key.
6. Display the results in a friendly formatted output.
7. Allow the user to check weather for multiple cities in a loop.
8. Convert temperature from Kelvin to Celsius if needed (depending on API units setting).
50 XP on completion Back to Day 8

Your Code

Output
Click "Run" to execute your code...

Log in to mark this project complete and earn XP.