šŸš€ Python Projects

Build real-world projects — the best way to learn!

🧮
Beginner

Simple Calculator

Add, subtract, multiply, divide — take input from user and show result

šŸŽ²
Beginner

Number Guessing Game

Computer chooses a random number, you have to guess it!

ā“
Beginner

Quiz App

Multiple choice quiz — track score and show result

šŸ”
Beginner

Password Generator

Generate random strong passwords with custom length

🧮

Project: Simple Calculator

ā–¼
Python
# 🧮 Simple Calculator
def calculator():
    print("=" * 30)
    print("🧮 PyMaster Calculator")
    print("=" * 30)

    while True:
        print("\nOptions: +  -  *  /  **  %  quit")
        op = input("Operation: ").strip()
        if op == "quit":
            print("Bye! šŸ‘‹"); break

        try:
            a = float(input("Number 1: "))
            b = float(input("Number 2: "))

            if op == "+": result = a + b
            elif op == "-": result = a - b
            elif op == "*": result = a * b
            elif op == "/":
                if b == 0:
                    print("āŒ Cannot divide by zero!"); continue
                result = a / b
            elif op == "**": result = a ** b
            elif op == "%": result = a % b
            else:
                print("āŒ Invalid operation!"); continue

            print(f"āœ… {a} {op} {b} = {result}")
        except ValueError:
            print("āŒ Please enter valid numbers!")

calculator()
šŸŽ²

Project: Number Guessing Game

ā–¼
Python
# šŸŽ² Number Guessing Game
import random

def guessing_game():
    secret = random.randint(1, 100)
    attempts = 0
    max_attempts = 10

    print("šŸŽ² Number Guessing Game!")
    print(f"Guess between 1-100 (Max {max_attempts} tries)")
    print("-" * 30)

    while attempts < max_attempts:
        try:
            guess = int(input(f"Attempt {attempts+1}: "))
            attempts += 1

            if guess == secret:
                print(f"šŸŽ‰ Correct! {secret} in {attempts} attempts!")
                return
            elif guess < secret:
                print("šŸ“ˆ Too low! Go higher!")
            else:
                print("šŸ“‰ Too high! Go lower!")
        except ValueError:
            print("Enter a valid number!")

    print(f"😢 Game Over! Number was {secret}")

guessing_game()
šŸ“
Intermediate

To-Do App

Add, delete, complete tasks — save to file

šŸ“
Intermediate

File Organizer

Automatically organize files into folders by type

šŸ“‡
Intermediate

Contact Book

Add, search, update, delete contacts — save/load from JSON

šŸ“

Project: To-Do App

ā–¼
Python
# šŸ“ To-Do App with File Storage
import json, os

FILE = "todos.json"

def load_todos():
    if os.path.exists(FILE):
        with open(FILE) as f: return json.load(f)
    return []

def save_todos(todos):
    with open(FILE, "w") as f: json.dump(todos, f, indent=2)

def show_todos(todos):
    if not todos:
        print("šŸ“­ No tasks yet!"); return
    print("\nšŸ“‹ Your Tasks:")
    for i, t in enumerate(todos, 1):
        status = "āœ…" if t["done"] else "⬜"
        print(f"  {i}. {status} {t['task']}")

def main():
    todos = load_todos()
    while True:
        print("\n--- To-Do Menu ---")
        print("1. View  2. Add  3. Complete  4. Delete  5. Quit")
        ch = input("Choose: ")

        if ch == "1": show_todos(todos)
        elif ch == "2":
            task = input("New task: ")
            todos.append({"task": task, "done": False})
            save_todos(todos)
            print(f"āœ… Added: {task}")
        elif ch == "3":
            show_todos(todos)
            idx = int(input("Complete #: ")) - 1
            if 0 <= idx < len(todos):
                todos[idx]["done"] = True
                save_todos(todos); print("Done! āœ…")
        elif ch == "4":
            show_todos(todos)
            idx = int(input("Delete #: ")) - 1
            if 0 <= idx < len(todos):
                removed = todos.pop(idx)
                save_todos(todos)
                print(f"šŸ—‘ļø Deleted: {removed['task']}")
        elif ch == "5": print("Bye! šŸ‘‹"); break

main()
šŸ“

Project: File Organizer

ā–¼
Python
# šŸ“ Automatic File Organizer
import os, shutil

def organize_folder(folder_path):
    file_types = {
        "Images": [".jpg",".jpeg",".png",".gif",".svg",".webp"],
        "Documents": [".pdf",".doc",".docx",".txt",".xlsx",".pptx"],
        "Videos": [".mp4",".mkv",".avi",".mov"],
        "Music": [".mp3",".wav",".flac",".aac"],
        "Code": [".py",".js",".html",".css",".java",".cpp"],
        "Archives": [".zip",".rar",".7z",".tar"],
    }

    for filename in os.listdir(folder_path):
        filepath = os.path.join(folder_path, filename)
        if os.path.isdir(filepath): continue

        ext = os.path.splitext(filename)[1].lower()
        dest_folder = "Others"

        for category, extensions in file_types.items():
            if ext in extensions:
                dest_folder = category; break

        dest_path = os.path.join(folder_path, dest_folder)
        os.makedirs(dest_path, exist_ok=True)
        shutil.move(filepath, os.path.join(dest_path, filename))
        print(f"šŸ“¦ {filename} → {dest_folder}/")

    print("āœ… All files organized!")

# Usage: organize_folder("C:/Users/you/Downloads")
🌐
Advanced

Web App with Flask

Build a simple web application with Flask

šŸ¤–
Advanced

ML Prediction App

Train Machine Learning model and make predictions

šŸ•·ļø
Advanced

Web Scraper

Automatically extract data from websites

🌐

Project: Flask Web App

ā–¼
Python
# 🌐 Simple Flask Web App
# pip install flask
from flask import Flask, render_template_string

app = Flask(__name__)

HTML = """
<!DOCTYPE html>
<html>
<head><title>PyMaster App</title>
<style>
  body { font-family: sans-serif; text-align: center;
         padding: 50px; background: #1a1a2e; color: white; }
  h1 { font-size: 3rem; }
  .btn { padding: 12px 24px; background: #6366f1; color: white;
         border: none; border-radius: 8px; font-size: 1rem;
         cursor: pointer; text-decoration: none; }
</style>
</head>
<body>
  <h1>šŸ PyMaster Flask App</h1>
  <p>Welcome! This is built with Python Flask.</p>
  <a href="/about" class="btn">About</a>
</body>
</html>
"""

@app.route("/")
def home():
    return render_template_string(HTML)

@app.route("/about")
def about():
    return "<h1>About PyMaster</h1><p>A Python learning platform!</p>"

if __name__ == "__main__":
    app.run(debug=True)
šŸš€
Run it: python app.py → Open http://localhost:5000