Python Projects for Beginners: 10 Projects with Code - Python with AI tutorial chapter 47
Python

Python Projects for Beginners: 10 Projects with Code

Python with AI Tutorial · Chapter 47 of 48

These Python projects for beginners are ten small, complete programs that each solve a real office task: invoices, deadlines, expenses, exchange rates, a sales chart and an AI meeting summary. Every project is under 30 lines, runs on Python 3.12, prints a result you can check, and lists the course chapters it uses so you know exactly where to look when a line is unclear.

How to work through them

Type each project rather than pasting it, run it, then change one thing: a rate, a column, a filename. Projects 1 to 7 need only the standard library. Project 8 needs pip install requests, project 9 needs pip install pandas matplotlib, and project 10 needs pip install anthropic plus an API key in the ANTHROPIC_API_KEY environment variable. When something breaks, use the routine from the debugging chapter before you ask an assistant.

1. Invoice calculator

Totals a list of line items, adds VAT and prints an aligned invoice. Uses lists, numbers and string formatting.

items = [("Laptop", 1, 1100.00), ("Monitor", 2, 250.00), ("Keyboard", 3, 49.50)]
VAT_RATE = 0.18

subtotal = sum(qty * price for _, qty, price in items)
vat = subtotal * VAT_RATE
total = subtotal + vat

print(f"{'Item':<10}{'Qty':>4}{'Price':>10}{'Line':>10}")
for name, qty, price in items:
    print(f"{name:<10}{qty:>4}{price:>10.2f}{qty * price:>10.2f}")
print("-" * 34)
print(f"{'Subtotal':<24}{subtotal:>10.2f}")
print(f"{'VAT 18%':<24}{vat:>10.2f}")
print(f"{'TOTAL':<24}{total:>10.2f}")
Output:
Item       Qty     Price      Line
Laptop       1   1100.00   1100.00
Monitor      2    250.00    500.00
Keyboard     3     49.50    148.50
----------------------------------
Subtotal                   1748.50
VAT 18%                     314.73
TOTAL                      2063.23

2. Secure password generator

Builds passwords that always contain a lowercase letter, an uppercase letter, a digit and a symbol. Uses modules, strings, while loops and functions.

import secrets
import string

SYMBOLS = "!@#$%^&*"

def make_password(length: int = 14) -> str:
    alphabet = string.ascii_letters + string.digits + SYMBOLS
    while True:
        pw = "".join(secrets.choice(alphabet) for _ in range(length))
        if (any(c.islower() for c in pw) and any(c.isupper() for c in pw)
                and any(c.isdigit() for c in pw) and any(c in SYMBOLS for c in pw)):
            return pw

for _ in range(3):
    print(make_password())
Output:
q7R!vM2p@Lk9sX
Z4t&nW8bH#e1Qy
m3K^dP6r*Ts0Vj
(random - yours will differ)

3. Deadline countdown

Sorts projects by due date and shows how many days are left or that they are overdue. Uses dates, dictionaries and lambda.

from datetime import date

def days_left(deadline: date, today: date) -> int:
    return (deadline - today).days

projects = {
    "Website relaunch": date(2026, 9, 30),
    "Q3 report": date(2026, 10, 15),
    "Audit": date(2026, 9, 1),
}
today = date(2026, 9, 5)  # use date.today() in real life
for name, due in sorted(projects.items(), key=lambda kv: kv[1]):
    n = days_left(due, today)
    status = "OVERDUE" if n < 0 else "due today" if n == 0 else f"{n} days left"
    print(f"{name:<18} {due:%d %b %Y}  {status}")
Output:
Audit              01 Sep 2026  OVERDUE
Website relaunch   30 Sep 2026  25 days left
Q3 report          15 Oct 2026  40 days left

4. Review keyword counter

Finds the words customers use most in their reviews, ignoring filler words. Uses regex, sets and dictionaries via Counter.

import re
from collections import Counter

reviews = [
    "Fast delivery and great support. Great product!",
    "Delivery was slow but support was helpful.",
    "Great value, fast delivery, would buy again.",
]
STOP = {"and", "was", "but", "the", "a", "would", "again", "buy"}

words = re.findall(r"[a-z]+", " ".join(reviews).lower())
counts = Counter(w for w in words if w not in STOP)
for word, n in counts.most_common(5):
    print(f"{word:<10}{n}")
Output:
delivery  3
great     3
fast      2
support   2
product   1

5. Expense tracker with CSV

Appends expenses to a CSV file and totals them by category. Run it twice and the file keeps growing, which is the point. Uses CSV, file handling and functions.

import csv
from pathlib import Path

FILE = Path("expenses.csv")

def add_expense(day: str, category: str, amount: float) -> None:
    new_file = not FILE.exists()
    with FILE.open("a", newline="", encoding="utf-8") as f:
        writer = csv.writer(f)
        if new_file:
            writer.writerow(["date", "category", "amount"])
        writer.writerow([day, category, amount])

def summary() -> dict[str, float]:
    totals: dict[str, float] = {}
    with FILE.open(encoding="utf-8") as f:
        for row in csv.DictReader(f):
            totals[row["category"]] = totals.get(row["category"], 0) + float(row["amount"])
    return totals

add_expense("2026-09-01", "Travel", 120.50)
add_expense("2026-09-02", "Software", 49.00)
add_expense("2026-09-03", "Travel", 35.00)
for category, total in summary().items():
    print(f"{category:<10}{total:>8.2f}")
Output:
Travel      155.50
Software     49.00

6. To-do list saved as JSON

Stores tasks in a JSON file so they survive between runs, and lets you mark one as done. Uses JSON, file handling and lists of dictionaries.

import json
from pathlib import Path

FILE = Path("todo.json")

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

def save(tasks: list[dict]) -> None:
    FILE.write_text(json.dumps(tasks, indent=2), encoding="utf-8")

def add(text: str) -> None:
    tasks = load()
    tasks.append({"task": text, "done": False})
    save(tasks)

def complete(index: int) -> None:
    tasks = load()
    tasks[index]["done"] = True
    save(tasks)

add("Send invoice to Acme")
add("Book Q4 planning room")
complete(0)
for i, t in enumerate(load()):
    print(f"[{'x' if t['done'] else ' '}] {i}. {t['task']}")
Output:
[x] 0. Send invoice to Acme
[ ] 1. Book Q4 planning room

7. Bank account with a statement

A class that tracks deposits and withdrawals, refuses overdrafts and prints a statement. Uses classes, try/except and string formatting.

class Account:
    def __init__(self, owner: str, balance: float = 0.0):
        self.owner = owner
        self.balance = balance
        self.history: list[tuple[str, float]] = []

    def deposit(self, amount: float) -> None:
        self.balance += amount
        self.history.append(("deposit", amount))

    def withdraw(self, amount: float) -> None:
        if amount > self.balance:
            raise ValueError(f"Insufficient funds: balance {self.balance:.2f}")
        self.balance -= amount
        self.history.append(("withdraw", amount))

    def statement(self) -> str:
        lines = [f"{kind:<9}{amt:>10.2f}" for kind, amt in self.history]
        return "\n".join(lines + [f"{'balance':<9}{self.balance:>10.2f}"])

acc = Account("Acme Ltd", 500)
acc.deposit(1200)
acc.withdraw(300)
try:
    acc.withdraw(5000)
except ValueError as e:
    print("Error:", e)
print(acc.statement())
Output:
Error: Insufficient funds: balance 1400.00
deposit     1200.00
withdraw     300.00
balance     1400.00

8. Live exchange rates from an API

Fetches today’s rates from the free Frankfurter API and converts an amount. Uses requests and APIs, JSON and dictionaries.

import requests

url = "https://api.frankfurter.app/latest"
response = requests.get(url, params={"from": "USD", "to": "EUR,GBP,INR"}, timeout=10)
response.raise_for_status()
data = response.json()

print("Rates for", data["date"])
for currency, rate in sorted(data["rates"].items()):
    print(f"1 USD = {rate:>8.2f} {currency}")

amount = 2500
print(f"{amount} USD = {amount * data['rates']['EUR']:.2f} EUR")
Output:
Rates for 2026-09-04
1 USD =     0.86 EUR
1 USD =     0.74 GBP
1 USD =    83.91 INR
2500 USD = 2150.00 EUR
(rates change daily)

9. Sales report chart

Builds a half-year table, finds the best month and saves a grouped bar chart as PNG. Uses pandas and matplotlib.

import pandas as pd
import matplotlib.pyplot as plt

data = {
    "Month": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    "Online": [42000, 45500, 51000, 49800, 56000, 60500],
    "Retail": [38000, 36500, 39000, 41000, 40200, 43800],
}
df = pd.DataFrame(data).set_index("Month")
df["Total"] = df.sum(axis=1)
print(df)
print("Best month:", df["Total"].idxmax(), "with", df["Total"].max())

ax = df[["Online", "Retail"]].plot(kind="bar", figsize=(8, 4), title="Sales by channel, H1 2026")
ax.set_ylabel("Revenue")
plt.tight_layout()
plt.savefig("sales_h1_2026.png", dpi=150)
print("chart saved to sales_h1_2026.png")
Output:
       Online  Retail   Total
Month
Jan     42000   38000   80000
Feb     45500   36500   82000
Mar     51000   39000   90000
Apr     49800   41000   90800
May     56000   40200   96200
Jun     60500   43800  104300
Best month: Jun with 104300
chart saved to sales_h1_2026.png

10. AI meeting-notes summariser

Reads a notes file, asks the model for a summary and action items, and writes the result to a new file. Uses the AI API chapter and file handling. The key is read from the environment, never typed into the script.

from pathlib import Path
import anthropic

notes = Path("meeting_notes.txt")
if not notes.exists():
    notes.write_text(
        "Sales sync 4 Sep 2026. Q3 pipeline is 1.2M, up 15%. Acme renewal at risk, "
        "Priya to call them Friday. New pricing page launches 20 Sep. Two SDR roles open.",
        encoding="utf-8",
    )

client = anthropic.Anthropic()  # uses ANTHROPIC_API_KEY
msg = client.messages.create(
    model="claude-sonnet-5", max_tokens=400,
    system=("Summarise meeting notes as 1) three bullet points and 2) action items "
            "with owner and date. Use only facts from the notes. Plain text."),
    messages=[{"role": "user", "content": notes.read_text(encoding="utf-8")}],
)
summary = msg.content[0].text
Path("meeting_summary.txt").write_text(summary, encoding="utf-8")
print(summary)
Output:
Summary
- Q3 pipeline stands at 1.2M, up 15%.
- The Acme renewal is at risk.
- A new pricing page launches on 20 Sep; two SDR roles are open.
Action items
- Priya: call Acme about the renewal - Friday
- Marketing: launch pricing page - 20 Sep
Try it with AI

Pick one project and ask for a stretch version that stays under 40 lines.

Here is a Python 3.12 script for a beginner project: [paste project 5, the CSV expense tracker]. Extend it so that summary() also returns the total per month, and add a command-line argument that filters by category. Keep it under 40 lines, standard library only, and explain the changes in three bullets.
Tip: when an assistant rewrites a project it may switch to a library you have not installed or to a Python 3.13-only feature. Compare its imports with the originals above, and keep the Python version in your prompt.
Try it with AI

Get a code review of your own version before you move on.

Review this Python script as a senior developer would: [paste your code]. List up to five improvements in order of importance, covering correctness, naming, error handling and readability. For each one show the changed lines only. Do not rewrite the whole file.

What to build next

The fastest way to grow from these ten programs is to combine them. Feed the expense tracker’s CSV into the pandas chart, let the deadline countdown read its projects from the JSON to-do file, or have the meeting summariser append its action items to that same list. Each combination forces you to agree on a data format between two scripts, which is the skill that separates scripts from systems.

When a project works, make it a little more robust before you leave it: validate the inputs, handle the file-not-found case, and print a clear message instead of a traceback. Then put the folder on GitHub with a short README that says what the script does, how to run it and what you would improve. Three or four such folders are a better portfolio than one unfinished large application, and they give you concrete code to discuss with an AI assistant when you want a review.

If you want a bigger challenge, the natural next steps are a Streamlit front end for the chatbot from chapter 44, a scheduled version of the Excel report from chapter 45, and a small web scraper that feeds the review keyword counter with real text.

Common mistakes

  • Copying the code instead of typing it; the typing is where the learning happens.
  • Running the CSV and JSON projects from a different folder and wondering where the file went; check Path.cwd().
  • Installing requests, pandas or anthropic into a different Python than the one running the script.
  • Putting the API key in project 10 as a string; use the environment variable.
  • Trying to build all ten in one sitting. One project a day, then extend it, works better.

Exercise

Combine projects 5 and 9: read expenses.csv with pandas, total the amounts by category and save a pie chart as expenses.png.

Show answer
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("expenses.csv")
totals = df.groupby("category")["amount"].sum()
print(totals)
totals.plot(kind="pie", autopct="%1.0f%%", title="Expenses by category", ylabel="")
plt.tight_layout()
plt.savefig("expenses.png", dpi=150)
Output:
category
Software     49.0
Travel      155.5
Name: amount, dtype: float64

Related chapters

FAQ

What Python projects should a beginner start with?

Start with programs that use only variables, lists, loops and functions, such as the invoice calculator and deadline countdown here, then add files, APIs and pandas one project at a time.

Do I need to know pandas for these Python projects?

Only for project 9 and the exercise. The first eight projects use the standard library, so you can finish them right after the functions and files chapters.

Can I put these beginner projects in a portfolio?

Yes, once you have extended them. Add a README, handle errors, write two or three tests and push the folder to GitHub; the extensions show your own thinking.

Working with spreadsheets too? Ready-made Excel, Google Sheets and Power BI templates are at NextGenTemplates.com.

Chapter 47 of 48 · Python with AI: all 48 chapters

PK
Meet PK, the founder of NeotechNavigators.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your data analysis skills to the next level!
https://neotechnavigators.com