Build a Personal Finance Tracker - Day 2: Adding Classes
Level: Beginner
Projects in this week’s series:
This week, we progressively build a finance tracker with Python.
Day 1: Basic with Functions
Day 2: Object-Oriented (Today)
Day 3: With CSV Storage
Day 4: With GUI
Today’s Project
Yesterday we built our MVP — a working expense tracker using functions. Today we’re learning a crucial real-world skill: refactoring.
As your codebase grows, you need better organization. That’s where Object-Oriented Programming comes in. We’ll transform our function-based tracker into a class-based system, making it more scalable and professional.
This is exactly what happens in real development: you start with working code, then improve the architecture when you need more structure.
👉 TIP: Click the “Project Code Timeline” button at the bottom of this page to view and compare today’s code solution with yesterday’s code and see a web interface that shows how the code has evolved (here is a snapshot):
Today’s Challenge: Refactor with Classes
Today we’re taking the same functionality and organizing it with classes. We’ll create an Expense class to represent individual expenses and an ExpenseTracker class to manage the collection and operations.
Why refactor? Because as we add more features (budgets tomorrow, web interface Thursday), having organized classes will make our code much easier to extend and maintain.
Project Task
Create a class-based expense tracker that:
Uses an
Expenseclass to represent individual expensesUses an
ExpenseTrackerclass to manage all expensesStores expense data as object attributes
Implements methods for adding, viewing, and analyzing expenses
Maintains the same functionality as Day 1 but with better structure
Demonstrates how classes encapsulate data and behavior together
This project gives you hands-on practice with class creation, object instances, methods, and understanding when and why to refactor code — essential skills for professional development.
Expected Output
Coming Tomorrow
Tomorrow we’ll add CSV storage and budget limits — you’ll see how our class-based design makes adding these features much easier than it would have been with just functions!
View Code Evolution
Compare today’s solution with earlier versions and see how the code evolves.





This is brilliant