Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🟡 Advanced Python  ·  Lesson 31

Python Mini Projects for Beginners

In this lesson: Easy Python mini project ideas with complete code — calculator, quiz, to-do, number guess and more for practice. In Hindi & English.

Why build mini projects?

Reading lessons teaches syntax; projects teach programming. Each project below combines several topics from this course – functions, loops, dictionaries, files, JSON/CSV and error handling – into a small tool you can show in your portfolio or practical file.

ProjectSkills usedLevel
1. Expense trackerloops, functions, dict, JSON file, menusBeginner+
2. Password generatorsecrets, string, any(), setsBeginner
3. Quiz gameJSON, random, enumerate, zip, inputBeginner
4. Attendance reportcsv, Counter, f-string formattingBeginner+

Project 1: Expense tracker that remembers data

A menu-driven program that adds expenses, stores them in expenses.json and prints a category-wise report with a text bar chart. Data survives after you close the program.

Python – expense_tracker.py
"""Expense tracker – saves to expenses.json between runs."""
import json
from datetime import date
from pathlib import Path

FILE = Path("expenses.json")
CATEGORIES = ["food", "travel", "books", "bills", "other"]


def load():
    if FILE.exists():
        return json.loads(FILE.read_text(encoding="utf-8"))
    return []


def save(expenses):
    FILE.write_text(json.dumps(expenses, indent=2), encoding="utf-8")


def add(expenses):
    amount = float(input("Amount (₹): "))
    category = input(f"Category {CATEGORIES}: ").strip().lower()
    if category not in CATEGORIES:
        category = "other"
    note = input("Note: ").strip()
    expenses.append({"date": date(2026, 10, 25).isoformat(), "amount": amount, "category": category, "note": note})
    save(expenses)
    print("✅ saved")


def report(expenses):
    total = sum(e["amount"] for e in expenses)
    print(f"Total spent: ₹{total:,.0f}")
    by_cat = {}
    for e in expenses:
        by_cat[e["category"]] = by_cat.get(e["category"], 0) + e["amount"]
    for cat, amt in sorted(by_cat.items(), key=lambda x: -x[1]):
        bar = "█" * int(amt / total * 20)
        print(f"  {cat:<7} ₹{amt:>7,.0f} {bar}")


def main():
    expenses = load()
    while True:
        choice = input("\n1) Add  2) Report  3) Quit → ")
        if choice == "1":
            add(expenses)
        elif choice == "2":
            report(expenses)
        elif choice == "3":
            print("Bye!")
            break
        else:
            print("Please type 1, 2 or 3")


if __name__ == "__main__":
    main()
1) Add 2) Report 3) Quit → 1 Amount (₹): 450 Category ['food', 'travel', 'books', 'bills', 'other']: food Note: Pizza with friends ✅ saved 1) Add 2) Report 3) Quit → 1 Amount (₹): 1200 Category ['food', 'travel', 'books', 'bills', 'other']: books Note: NCERT guides ✅ saved 1) Add 2) Report 3) Quit → 1 Amount (₹): 180 Category ['food', 'travel', 'books', 'bills', 'other']: travel Note: Auto ✅ saved 1) Add 2) Report 3) Quit → 2 Total spent: ₹1,830 books ₹ 1,200 █████████████ food ₹ 450 ████ travel ₹ 180 █ 1) Add 2) Report 3) Quit → 5 Please type 1, 2 or 3 1) Add 2) Report 3) Quit → 3 Bye!
  • Path.read_text/write_text keep file code short.
  • Invalid category falls back to “other” instead of crashing.
  • The report sorts categories by amount and draws bars with "█" * n.
  • Improve it: delete an expense, monthly filter, export to CSV.
📝 About the date

The demo uses a fixed date so the output stays the same. In your copy replace date(2026, 10, 25) with date.today().

Project 2: Strong password generator and checker

Python – password_tool.py
"""Strong password generator + strength checker."""
import secrets
import string


def generate(length=12):
    if length < 8:
        raise ValueError("use at least 8 characters")
    pools = [string.ascii_lowercase, string.ascii_uppercase, string.digits, "!@#$%&*?"]
    chars = [secrets.choice(pool) for pool in pools]              # one from each pool
    everything = "".join(pools)
    chars += [secrets.choice(everything) for _ in range(length - len(chars))]
    secrets.SystemRandom().shuffle(chars)
    return "".join(chars)


def strength(pw):
    checks = {
        "8+ characters": len(pw) >= 8,
        "lowercase": any(c.islower() for c in pw),
        "uppercase": any(c.isupper() for c in pw),
        "digit": any(c.isdigit() for c in pw),
        "symbol": any(not c.isalnum() for c in pw),
        "not common": pw.lower() not in {"password", "12345678", "qwerty123", "india@123"},
    }
    score = sum(checks.values())
    missing = [name for name, ok in checks.items() if not ok]
    label = "strong" if score == 6 else "medium" if score >= 4 else "weak"
    return label, missing


new = generate(14)
print("generated length:", len(new), "| strength:", strength(new)[0])
for pw in ["india@123", "Gagan2026", "Riya#Delhi2026"]:
    label, missing = strength(pw)
    print(f"{pw:<15} {label:<7} missing: {', '.join(missing) or '-'}")
generated length: 14 | strength: strong india@123 medium missing: uppercase, not common Gagan2026 medium missing: symbol Riya#Delhi2026 strong missing: -
  • Use secrets, not random, for passwords – it is designed for security.
  • Taking one character from each pool guarantees every rule is met.
  • The checker returns why a password is weak, which is more useful than a score alone.

Project 3: Quiz game from a JSON file

JSON – questions.json
[
  {"q": "Which keyword defines a function in Python?", "options": ["func", "def", "function", "define"], "answer": 1},
  {"q": "What does len([3, 5, 7]) return?", "options": ["2", "3", "7", "15"], "answer": 1},
  {"q": "Which type is immutable?", "options": ["list", "dict", "set", "tuple"], "answer": 3}
]
Python – quiz.py
"""Quiz game – questions come from a JSON file, score is saved."""
import json
import random

random.seed(7)                     # remove this line for a different order every time

with open("questions.json", encoding="utf-8") as f:
    questions = json.load(f)

random.shuffle(questions)
score = 0
for i, q in enumerate(questions, start=1):
    print(f"\nQ{i}. {q['q']}")
    for letter, option in zip("abcd", q["options"]):
        print(f"   {letter}) {option}")
    answer = input("Your answer: ").strip().lower()
    correct = "abcd"[q["answer"]]
    if answer == correct:
        score += 1
        print("✔ Correct")
    else:
        print(f"✘ Wrong – correct answer is {correct}) {q['options'][q['answer']]}")

print(f"\nScore: {score}/{len(questions)} ({score / len(questions):.0%})")
Q1. Which type is immutable? a) list b) dict c) set d) tuple Your answer: d ✔ Correct Q2. Which keyword defines a function in Python? a) func b) def c) function d) define Your answer: c ✘ Wrong – correct answer is b) def Q3. What does len([3, 5, 7]) return? a) 2 b) 3 c) 7 d) 15 Your answer: b ✔ Correct Score: 2/3 (67%)

Because questions live in a JSON file, a teacher can add 50 new questions without touching the code. Ideas: timer per question, categories, save high scores in a file.

Project 4: Attendance report from a CSV register

CSV – attendance.csv
name,Mon,Tue,Wed,Thu,Fri,Sat
Asha,P,P,P,P,P,P
Ravi,P,A,P,A,A,P
Neha,P,P,A,P,P,P
Kabir,A,P,P,P,A,A
Python – attendance_report.py
"""Attendance summary from a CSV register."""
import csv
from collections import Counter

with open("attendance.csv", newline="", encoding="utf-8") as f:
    rows = list(csv.DictReader(f))

days = [d for d in rows[0] if d != "name"]
print(f"{'Name':<8} {'Present':>7} {'%':>6}  Status")
present_per_day = Counter()
for r in rows:
    present = sum(r[d] == "P" for d in days)
    for d in days:
        present_per_day[d] += r[d] == "P"
    pct = present / len(days) * 100
    status = "OK" if pct >= 75 else "⚠ below 75%"
    print(f"{r['name']:<8} {present:>7} {pct:>5.0f}%  {status}")

low_day, count = min(present_per_day.items(), key=lambda x: x[1])
print(f"\nLowest attendance: {low_day} ({count}/{len(rows)} students)")
Name Present % Status Asha 6 100% OK Ravi 3 50% ⚠ below 75% Neha 5 83% OK Kabir 3 50% ⚠ below 75% Lowest attendance: Fri (2/4 students)

Teachers can export the register from Google Sheets as CSV and get this report in one second. Extend it: email parents of students below 75%, or plot attendance with matplotlib.

More project ideas (with the lesson to read first)

ProjectRead first
Weather report using a free APIAPIs and requests
Price list scraper to CSVWeb scraping
Library management with SQLiteSQL with SQLite
Student marks dashboardStudent performance project
Bill generator with testsTesting and debugging

How to present a project

  1. Put each project in its own folder with a README.md: what it does, how to run, a sample output.
  2. Add requirements.txt if it uses packages.
  3. Upload to GitHub and add the link to your resume.
  4. Be ready to explain one design decision (e.g. why JSON, why secrets).

Frequently Asked Questions

Can I use these projects in my Class 11/12 practical file?
Yes. Type them yourself, run them, understand every line and add your own improvement – teachers value a small change you can explain more than a copied long program.
Do I need to install anything?
No. All four projects use only the Python standard library (json, csv, secrets, random, pathlib, collections).
← Back to Python Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 Live Code Editor

This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.
Next topicLinear Algebra Basics Your progress: 31 / 66 (47%) · Lesson 32 / 66 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free