Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

Personal Budget Analyzer

Turn a month of raw expenses into a full spending report with category totals, percentages and a text bar chart — the same analysis every budgeting app performs.

Beginner 4 steps 80 XP ~30 min

How it works in the real world

Every budgeting app (YNAB, Revolut analytics, your bank's spending view) runs this exact pipeline:

  1. Ingest — raw transactions arrive as (category, amount) records.
  2. Aggregate — sum per category with a dictionary.
  3. Analyse — turn totals into percentages and find the biggest drain.
  4. Present — format a report humans actually read.

You'll build each stage as its own step — by the end you have a working analyzer you could point at your own bank export.

Build progress0 / 4 steps
1

Total up the month

Loop over expenses and print the total as Total spent: 1295.

Blank · autosaved
PYstep_1.py
Run your code to check this step…
2

Group by category

Real data has repeat categories. Build a dict of per-category totals and print each as category: total (in first-seen order).

Blank · autosaved
PYstep_2.py
Run your code to check this step…
3

Percentages & the biggest drain

Print each category as category: XX.X% of total spending (1 decimal), then Biggest: rent for the largest category.

Blank · autosaved
PYstep_3.py
Run your code to check this step…
4

The final report

Ship it: print a header === July Budget ===, one aligned line per category ({category:<12}{amount} plus a bar of # per full 100), and Total: 1265.

Blank · autosaved
PYstep_4.py
Run your code to check this step…
Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path