Top 10 Python Projects for Beginners (With Source Code)

0
Python • Beginner Friendly

Top 10 Python Projects for Beginners (With Source Code)

Projects = Fast Learning. Niche projects ke through aap input/output, loops, lists, dictionaries, functions, modules jaise concepts ko practically samjhenge. Niche diye gaye 10 projects copy-paste runnable code ke saath hain.

Table of Contents
  1. Calculator
  2. To-Do List (CLI)
  3. Number Guessing Game
  4. Quiz App
  5. Rock-Paper-Scissors
  6. Password Generator
  7. BMI Calculator
  8. Simple Stopwatch / Timer
  9. File Organizer
  10. Weather (API free alt: mock)
How to run: PC me python file_name.py (Windows) ya python3 file_name.py (Linux/Mac). Code copy karke .py file me save karein.

1) Calculator

Concepts: Input/Output, Operators, Basic Validation

# calculator.py def calc(a, b): return { "sum": a + b, "diff": a - b, "prod": a * b, "quot": a / b if b != 0 else "∞ (division by zero)" } try: a = float(input("Enter first number: ")) b = float(input("Enter second number: ")) result = calc(a, b) for k, v in result.items(): print(f"{k} = {v}") except ValueError: print("Please enter valid numbers!")
Tip: Add power (**) and percentage features to make it advanced.

2) To-Do List (CLI)

Concepts: Lists, Loops, File I/O (persistence)

# todo.py import json, os DB = "tasks.json" def load_tasks(): return json.load(open(DB)) if os.path.exists(DB) else [] def save_tasks(tasks): json.dump(tasks, open(DB, "w"), indent=2) def show(tasks): if not tasks: print("No tasks."); return for i, t in enumerate(tasks, 1): print(f"{i}. {t}") tasks = load_tasks() while True: cmd = input("(A)dd (D)elete (L)ist (Q)uit: ").lower().strip() if cmd == "a": tasks.append(input("Task: ").strip()) save_tasks(tasks); print("Added.") elif cmd == "d": show(tasks) try: i = int(input("Delete #?: ")) tasks.pop(i-1); save_tasks(tasks); print("Deleted.") except: print("Invalid.") elif cmd == "l": show(tasks) elif cmd == "q": break else: print("Unknown command.")

3) Number Guessing Game

Concepts: Random, Loops, Conditions

# guess.py import random secret = random.randint(1, 10) for attempt in range(3): try: g = int(input("Guess (1-10): ")) if g == secret: print("Correct! 🎉"); break print("Too low" if g < secret else "Too high") except: print("Enter a number!") else: print("Out of tries! Number was:", secret)

4) Quiz App

Concepts: Dict, Loops, Scoring

# quiz.py q = { "2 + 2 = ?": "4", "Capital of India?": "Delhi", "Language of 'print()' function?": "Python" } score = 0 for ques, ans in q.items(): user = input(ques + " ").strip().lower() if user == ans.lower(): score += 1 print(f"Your Score: {score}/{len(q)}")
Extend: Load questions from a JSON file; add negative marking.

5) Rock-Paper-Scissors

Concepts: Random, Game Logic

# rps.py import random choices = ["rock", "paper", "scissors"] user = input("Your choice (rock/paper/scissors): ").lower() comp = random.choice(choices) print("Computer:", comp) win = (user == "rock" and comp == "scissors") or \ (user == "paper" and comp == "rock") or \ (user == "scissors" and comp == "paper") if user == comp: print("Draw") elif win: print("You Win!") elif user in choices: print("You Lose!") else: print("Invalid choice")

6) Password Generator

Concepts: Random, Strings, Functions

# password_gen.py import random, string def gen_password(length=12, use_symbols=True): chars = string.ascii_letters + string.digits if use_symbols: chars += "!@#$%^&*()-_=+[]{}" return "".join(random.choice(chars) for _ in range(length)) print("Strong Password:", gen_password(14))
Pro: Add check for complexity (min 1 digit, 1 symbol, etc.).

7) BMI Calculator

Concepts: Math, Input Validation, Formatting

# bmi.py def bmi(h_m, w_kg): b = w_kg/(h_m*h_m) if b < 18.5: cat = "Underweight" elif b < 25: cat = "Normal" elif b < 30: cat = "Overweight" else: cat = "Obese" return b, cat try: h = float(input("Height (meters): ")) w = float(input("Weight (kg): ")) val, cat = bmi(h, w) print(f"BMI: {val:.2f} → {cat}") except: print("Please enter valid numbers.")

8) Simple Stopwatch / Timer

Concepts: time module, Loops

# stopwatch.py import time print("Press Ctrl+C to stop") start = time.time() try: while True: elapsed = time.time() - start print(f"\rElapsed: {elapsed:0.1f}s", end="") time.sleep(0.1) except KeyboardInterrupt: print("\nStopped.")

9) File Organizer

Concepts: OS module, File Handling

# file_organizer.py import os, shutil, pathlib RULES = {".jpg":"Images",".png":"Images",".pdf":"Docs",".txt":"Docs",".zip":"Zips",".py":"Code"} def organize(folder="."): folder = pathlib.Path(folder) for f in folder.iterdir(): if f.is_file(): ext = f.suffix.lower() target = folder / RULES.get(ext, "Others") target.mkdir(exist_ok=True) shutil.move(str(f), str(target/f.name)) organize(".") # current directory print("Organized!")
Note: Test in a sample folder first.

10) Weather (API or Mock)

Concepts: HTTP requests, JSON parsing (mock fallback)

# weather.py (mock without API key) data = {"city": "Delhi", "temp_c": 33.5, "cond": "Haze"} print(f"{data['city']}: {data['temp_c']}°C, {data['cond']}") # If you have 'requests' and an API key: # import requests # url = "https://api.open-meteo.com/v1/forecast?latitude=28.61&longitude=77.21¤t_weather=true" # r = requests.get(url).json() # cw = r.get("current_weather", {}) # print("Delhi:", cw.get("temperature"), "°C, wind", cw.get("windspeed"))

FAQs (Quick)

Is Python good for absolute beginners?

Yes. Simple syntax, huge community, aur bahut saare ready libraries.

Projects kaise choose karein?

Jo daily life me useful ho (calculators, organizers, notes). Chhota start karo, features add karte jao.

In projects ko kaise improve karein?

Input validation, files/database save, CLI se GUI/Flask web app tak upgrade.

Want the Full Source Pack (ZIP + PDF)?

Agar aapko is post ka ZIP source + printable PDF chahiye, niche comment karein ya contact page se message bhejein. Main next update me download link add kar dunga.

Explore More Python Tutorials

Liked this post? Share with friends & bookmark for later. Internal links: Python Basics • Java Programs • DSA Notes • Mini Projects.

Post a Comment

0Comments
Post a Comment (0)