💡Build Your Own Weather Checker in Python💡

 



Have you ever opened your window in the morning and wondered, “Is it going to rain today?”

What if you could build your own weather-checking tool—something created by you, using just a few lines of Python?

In this tutorial, I’ll walk you through a very simple project where you learn how to fetch real-time weather data from the internet using Python.
This mini project is perfect for beginners who want to learn something practical and instantly useful.

The best part?
You don’t need to be a coding expert.
If you can copy-paste and follow steps, you can build this. 💡

🌦 Why This Project Is Perfect for Beginners

  • You learn how to use an API (real-world skill)

  • It takes less than 10 minutes

  • It gives instant output (your brain loves quick wins!)

  • You will understand how apps fetch live weather info

  • You can later convert this into a website, app, or automation

This tiny skill can become a stepping stone for bigger things:
automation, data science, AI projects… it all starts here.


🧭 Step-by-Step Guide to Create Your Weather Checker

Below is the exact process — simple, clean, and beginner-friendly.


📌 STEP 1 — Install the Required Library

We will use the requests library to call the weather API.

Open your terminal and type:

pip install requests

📌 STEP 2 — Get Your FREE API Key

We use OpenWeatherMap, one of the most popular weather data providers.

  1. Go to:
    👉 https://openweathermap.org/api

  2. Create a free account

  3. Open the API Keys tab

  4. Copy your API key

If you get stuck anywhere, don’t worry—just comment and I’ll help you instantly.


📌 STEP 3 — Create a File: weather_checker.py

Now create a new Python file and paste this code:

import requests API_KEY = "YOUR_API_KEY_HERE" BASE_URL = "https://api.openweathermap.org/data/2.5/weather" city = input("Enter city name: ") params = { "q": city, "appid": API_KEY, "units": "metric" } response = requests.get(BASE_URL, params=params) if response.status_code == 200: data = response.json() temp = data["main"]["temp"] humidity = data["main"]["humidity"] wind = data["wind"]["speed"] condition = data["weather"][0]["description"] print(f"\n🌍 Weather in {city.capitalize()}:") print(f"🌡 Temperature: {temp}°C") print(f"💧 Humidity: {humidity}%") print(f"🌬 Wind Speed: {wind} m/s") print(f"☁ Condition: {condition}") else: print("\nCity not found. Try again.")

👉 Replace YOUR_API_KEY_HERE with your real API key.


📌 STEP 4 — Run Your Script

Open your terminal:

python weather_checker.py

Example:

Enter city name: London

Output:

Weather in London: Temperature: 9°C Humidity: 82% Wind Speed: 3.5 m/s Condition: scattered clouds

Boom — your first weather app is ready! 🌤

🔥 "There is something magical about typing a city name and watching real-time weather appear because you made it happen. This small win might be the first step toward the developer you’re meant to become."🔥


Comments

Popular Posts