Skip to main content

Python Projects - Build Your Portfolio 🚀

The best way to learn Python is by building things. This page contains a curated collection of projects that will take you from a beginner to a confident developer. Each project includes learning objectives, key concepts, and starter code to get you going.

Project Progression Path


🟢 Beginner Projects

These projects focus on fundamentals: variables, conditionals, loops, functions, and basic data structures.


1. Number Guessing Game

A classic beginner project where the computer picks a random number and the player has to guess it.

Features:

  • Random number generation
  • Hint system (too high / too low)
  • Attempt counter
  • Replay option

Learning Objectives:

  • Understand random module
  • Practice while loops and conditionals
  • Handle user input and type conversion

Python Concepts: random.randint(), while loop, if/elif/else, input(), int() conversion

import random

def number_guessing_game():
number = random.randint(1, 100)
attempts = 0

print("Guess the number between 1 and 100!")

while True:
try:
guess = int(input("Your guess: "))
attempts += 1

if guess < number:
print("Too low!")
elif guess > number:
print("Too high!")
else:
print(f"Correct! You got it in {attempts} attempts.")
break
except ValueError:
print("Please enter a valid number.")

if input("Play again? (y/n): ").lower() == 'y':
number_guessing_game()

number_guessing_game()

2. To-Do List CLI App

A command-line to-do list manager that stores tasks in memory.

Features:

  • Add, view, complete, and delete tasks
  • Mark tasks as done
  • Simple text-based menu

Learning Objectives:

  • Work with lists and dictionaries
  • Build a menu-driven CLI interface
  • Practice string formatting

Python Concepts: list, dict, for loops, string methods, enumerate()

tasks = []

def show_menu():
print("\n--- TO-DO LIST ---")
print("1. Add task")
print("2. View tasks")
print("3. Mark complete")
print("4. Delete task")
print("5. Exit")

def add_task():
title = input("Task title: ")
tasks.append({"title": title, "done": False})
print("Task added!")

def view_tasks():
if not tasks:
print("No tasks yet.")
return
for i, task in enumerate(tasks, 1):
status = "✓" if task["done"] else " "
print(f"{i}. [{status}] {task['title']}")

def mark_done():
view_tasks()
try:
idx = int(input("Task number to mark done: ")) - 1
tasks[idx]["done"] = True
print("Marked as done!")
except (IndexError, ValueError):
print("Invalid task number.")

def delete_task():
view_tasks()
try:
idx = int(input("Task number to delete: ")) - 1
tasks.pop(idx)
print("Task deleted!")
except (IndexError, ValueError):
print("Invalid task number.")

while True:
show_menu()
choice = input("Choose an option: ")
if choice == "1": add_task()
elif choice == "2": view_tasks()
elif choice == "3": mark_done()
elif choice == "4": delete_task()
elif choice == "5": break
else: print("Invalid choice.")

3. Simple Calculator

A calculator that performs basic arithmetic operations.

Features:

  • Addition, subtraction, multiplication, division
  • Handles division by zero
  • Continuous operation mode

Learning Objectives:

  • Define and use functions
  • Handle edge cases and errors
  • Build a simple REPL loop

Python Concepts: def functions, try/except, match-case (or if/elif), arithmetic operators

def add(a, b): return a + b
def sub(a, b): return a - b
def mul(a, b): return a * b
def div(a, b):
if b == 0:
return "Error: Division by zero"
return a / b

operations = {"+": add, "-": sub, "*": mul, "/": div}

print("Simple Calculator")
print("Operations: +, -, *, /")

while True:
try:
a = float(input("Enter first number: "))
op = input("Enter operation: ")
b = float(input("Enter second number: "))

if op in operations:
result = operations[op](a, b)
print(f"{a} {op} {b} = {result}")
else:
print("Invalid operation.")

if input("Continue? (y/n): ").lower() != 'y':
break
except ValueError:
print("Please enter valid numbers.")

4. Personal Diary (File-Based)

A personal diary application that saves entries to a text file.

Features:

  • Write dated diary entries
  • View all past entries
  • Search entries by date

Learning Objectives:

  • Read and write text files
  • Work with dates and times
  • Build a persistent data app

Python Concepts: open(), file I/O (r, w, a), datetime module, string formatting

from datetime import datetime

FILE_NAME = "diary.txt"

def write_entry():
content = input("Write your entry: ")
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
with open(FILE_NAME, "a") as f:
f.write(f"[{timestamp}]\n{content}\n---\n")
print("Entry saved!")

def view_entries():
try:
with open(FILE_NAME, "r") as f:
print(f.read())
except FileNotFoundError:
print("No entries yet.")

def search_entries():
date = input("Enter date (YYYY-MM-DD): ")
try:
with open(FILE_NAME, "r") as f:
entries = f.read().split("---\n")
for entry in entries:
if date in entry:
print(entry)
except FileNotFoundError:
print("No entries found.")

while True:
print("\n--- PERSONAL DIARY ---")
print("1. Write entry")
print("2. View all entries")
print("3. Search by date")
print("4. Exit")
choice = input("Choose: ")
if choice == "1": write_entry()
elif choice == "2": view_entries()
elif choice == "3": search_entries()
elif choice == "4": break

🔵 Intermediate Projects

These projects introduce file handling, OOP, APIs, and more complex logic.


1. Expense Tracker (CSV-Based)

Track your daily expenses and save them to a CSV file.

Features:

  • Add expenses with category, amount, and date
  • View summary by category
  • Show total spending
  • Export to CSV

Learning Objectives:

  • Work with CSV files using the csv module
  • Aggregate and summarize data
  • Build a practical personal finance tool

Python Concepts: csv module, datetime, list/dict operations, sum()

import csv
from datetime import date

FILE = "expenses.csv"

def add_expense():
category = input("Category (Food/Transport/Entertainment/Other): ")
amount = float(input("Amount: "))
today = date.today().isoformat()
with open(FILE, "a", newline="") as f:
writer = csv.writer(f)
writer.writerow([today, category, amount])
print("Expense added!")

def view_summary():
total = 0
categories = {}
try:
with open(FILE, "r") as f:
reader = csv.reader(f)
for row in reader:
cat, amt = row[1], float(row[2])
total += amt
categories[cat] = categories.get(cat, 0) + amt
print(f"\nTotal: ₹{total:.2f}")
for cat, amt in categories.items():
print(f"{cat}: ₹{amt:.2f}")
except FileNotFoundError:
print("No expenses recorded yet.")

while True:
print("\n--- EXPENSE TRACKER ---")
print("1. Add expense")
print("2. View summary")
print("3. Exit")
choice = input("Choose: ")
if choice == "1": add_expense()
elif choice == "2": view_summary()
elif choice == "3": break

2. Quiz Application (OOP-Based)

An object-oriented quiz application with multiple-choice questions.

Features:

  • Question bank with multiple categories
  • Score tracking
  • Timer for each question
  • Final scoreboard

Learning Objectives:

  • Apply OOP principles (classes, objects)
  • Encapsulate question logic
  • Build reusable components

Python Concepts: class, __init__, methods, random.shuffle(), time module

import random
import time

class Question:
def __init__(self, text, options, correct):
self.text = text
self.options = options
self.correct = correct

def display(self):
print(f"\n{self.text}")
for i, opt in enumerate(self.options, 1):
print(f"{i}. {opt}")

def check(self, answer):
return self.options[answer - 1] == self.correct

class Quiz:
def __init__(self, questions):
self.questions = questions
self.score = 0

def start(self):
random.shuffle(self.questions)
for q in self.questions:
q.display()
try:
answer = int(input("Your answer (1-4): "))
if q.check(answer):
print("Correct!")
self.score += 1
else:
print(f"Wrong! Answer: {q.correct}")
except (ValueError, IndexError):
print("Invalid input.")
print(f"\nFinal Score: {self.score}/{len(self.questions)}")

questions = [
Question("What is the capital of France?", ["London", "Paris", "Berlin", "Madrid"], "Paris"),
Question("Which planet is known as the Red Planet?", ["Venus", "Jupiter", "Mars", "Saturn"], "Mars"),
Question("What is 5 + 7?", ["10", "11", "12", "13"], "12"),
]

Quiz(questions).start()

3. Library Management System

Manage books, members, and borrowing in a library.

Features:

  • Add and remove books
  • Register members
  • Borrow and return books
  • Track availability

Learning Objectives:

  • Design classes with relationships
  • Manage state across multiple objects
  • Handle edge cases (book already borrowed, etc.)

Python Concepts: OOP (classes, composition), list, dict, string formatting

class Book:
def __init__(self, title, author, isbn):
self.title = title
self.author = author
self.isbn = isbn
self.available = True

class Member:
def __init__(self, name, member_id):
self.name = name
self.member_id = member_id
self.borrowed = []

class Library:
def __init__(self):
self.books = []
self.members = []

def add_book(self, book):
self.books.append(book)

def register_member(self, member):
self.members.append(member)

def borrow_book(self, member_id, isbn):
member = next((m for m in self.members if m.member_id == member_id), None)
book = next((b for b in self.books if b.isbn == isbn and b.available), None)
if member and book:
book.available = False
member.borrowed.append(book)
print(f"{book.title} borrowed by {member.name}")
else:
print("Cannot complete borrowing.")

def return_book(self, member_id, isbn):
member = next((m for m in self.members if m.member_id == member_id), None)
if member:
book = next((b for b in member.borrowed if b.isbn == isbn), None)
if book:
book.available = True
member.borrowed.remove(book)
print(f"{book.title} returned.")
else:
print("Book not found in member's list.")

lib = Library()
lib.add_book(Book("Python 101", "John Doe", "123"))
lib.add_book(Book("Data Science", "Jane Doe", "456"))
lib.register_member(Member("Alice", "M001"))
lib.borrow_book("M001", "123")
lib.return_book("M001", "123")

4. Weather CLI App (API-Based)

Fetch real-time weather data from a public API.

Features:

  • Get weather by city name
  • Display temperature, humidity, conditions
  • Handle API errors gracefully

Learning Objectives:

  • Make HTTP requests with requests
  • Parse JSON responses
  • Work with environment variables for API keys

Python Concepts: requests module, JSON parsing, os.environ, try/except

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.openweathermap.org/data/2.5/weather"

def get_weather(city):
params = {"q": city, "appid": API_KEY, "units": "metric"}
try:
response = requests.get(BASE_URL, params=params)
response.raise_for_status()
data = response.json()
temp = data["main"]["temp"]
humidity = data["main"]["humidity"]
desc = data["weather"][0]["description"]
print(f"\nWeather in {city}:")
print(f"Temperature: {temp}°C")
print(f"Humidity: {humidity}%")
print(f"Conditions: {desc}")
except requests.exceptions.HTTPError:
print("City not found.")
except requests.exceptions.ConnectionError:
print("Network error.")

city = input("Enter city name: ")
get_weather(city)

🟠 Advanced Projects

These projects combine multiple concepts: databases, data analysis, and full application architecture.


1. Student Database System (SQLite)

A complete student management system using SQLite.

Features:

  • Add, update, delete students
  • Record grades per subject
  • Generate student reports
  • Search and filter

Learning Objectives:

  • Design a database schema
  • Execute SQL queries from Python
  • Build a full CRUD application

Python Concepts: sqlite3 module, SQL (CREATE, INSERT, SELECT, UPDATE, DELETE), parameterized queries

import sqlite3

conn = sqlite3.connect("students.db")
cursor = conn.cursor()

cursor.execute("""
CREATE TABLE IF NOT EXISTS students (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age INTEGER,
grade TEXT
)
""")

def add_student(name, age, grade):
cursor.execute("INSERT INTO students (name, age, grade) VALUES (?, ?, ?)", (name, age, grade))
conn.commit()
print(f"Added {name}")

def view_students():
cursor.execute("SELECT * FROM students")
for row in cursor.fetchall():
print(f"ID: {row[0]}, Name: {row[1]}, Age: {row[2]}, Grade: {row[3]}")

def update_grade(student_id, new_grade):
cursor.execute("UPDATE students SET grade = ? WHERE id = ?", (new_grade, student_id))
conn.commit()
print("Grade updated.")

def delete_student(student_id):
cursor.execute("DELETE FROM students WHERE id = ?", (student_id,))
conn.commit()
print("Student deleted.")

while True:
print("\n--- STUDENT DB SYSTEM ---")
print("1. Add student")
print("2. View students")
print("3. Update grade")
print("4. Delete student")
print("5. Exit")
choice = input("Choose: ")
if choice == "1":
add_student(input("Name: "), int(input("Age: ")), input("Grade: "))
elif choice == "2": view_students()
elif choice == "3":
update_grade(int(input("Student ID: ")), input("New grade: "))
elif choice == "4":
delete_student(int(input("Student ID: ")))
elif choice == "5": break

conn.close()

2. Data Analysis Dashboard (Pandas + CSV)

Analyze and visualize data from a CSV file using pandas and matplotlib.

Features:

  • Load and clean CSV data
  • Generate summary statistics
  • Create visualizations (bar, line, pie charts)
  • Export analysis report

Learning Objectives:

  • Use pandas for data manipulation
  • Create plots with matplotlib
  • Derive insights from real data

Python Concepts: pandas.read_csv(), DataFrame operations, matplotlib.pyplot, groupby(), aggregations

import pandas as pd
import matplotlib.pyplot as plt

# Sample sales data
data = {
"Month": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
"Sales": [12000, 15000, 13000, 18000, 16000, 22000],
"Expenses": [8000, 9000, 8500, 10000, 9500, 12000]
}

df = pd.DataFrame(data)
df["Profit"] = df["Sales"] - df["Expenses"]

print("=== DATA SUMMARY ===")
print(df.describe())
print(f"\nTotal Sales: ${df['Sales'].sum()}")
print(f"Average Profit: ${df['Profit'].mean():.2f}")

df.plot(x="Month", y=["Sales", "Expenses", "Profit"], kind="bar", title="Monthly Performance")
plt.ylabel("Amount ($)")
plt.tight_layout()
plt.savefig("dashboard.png")
print("\nChart saved as dashboard.png")
plt.show()

🏗️ Building Your Python Portfolio

A strong portfolio demonstrates your skills to employers and clients. Here is how to build one:

1. Choose Projects Wisely

Pick projects that solve real problems and showcase different skills — CLI tools, web apps, data analysis, and automation.

2. Host on GitHub

  • Create a GitHub repository for each project
  • Write a good README.md with description, setup instructions, and screenshots
  • Use proper .gitignore for Python (virtual environments, cache files)

3. Write Clean Code

4. Add Tests

  • Use unittest or pytest to write tests (Testing)
  • Aim for good test coverage on critical logic

5. Deploy & Share

  • Deploy CLI tools with PyInstaller (Deployment Guide)
  • Host web apps on Render, PythonAnywhere, or Railway
  • Share your portfolio link on LinkedIn and resume

💡 Tips for Project Success

TipWhy It Matters
Start small, then expandBuild a working MVP first, then add features
Use version controlGit lets you experiment without fear
Read error messagesPython errors tell you exactly what went wrong
Break problems downSplit big features into small, testable steps
Ask for code reviewsFresh eyes catch bugs and suggest improvements
Document as you goYour future self will thank you
Complete before perfectA finished project is better than a perfect half-done one


Ready to start building? Pick a project from the Beginner section and write your first line of code!