Project: Personal Finance Tracker
Build a professional-grade CLI tool to manage expenses, using JSON for storage and math for analysis.
Learning Objectives
- Model expense data using dictionaries
- Implement JSON-based data persistence
- Perform statistical analysis on collections
- Build a multi-feature CLI interface
Week 4 Milestone
You’ve learned the “Power Features” of Python: Standard library tools, JSON data, and project isolation. Today, you’ll build a Personal Finance Tracker to put it all together.
Project Requirements
Your application should allow a user to:
- Add an expense (Amount, Category, Date).
- View all expenses in a clean table.
- Analyze spending (Total spent, Average expense).
- Export/Import data automatically using a
finance.jsonfile.
Step 1: Modeling an Expense
finance.py
|
|
Step 2: Adding Analysis
analysis.py
|
|
Your Challenge
Implement the CLI loop in main():
- Use Type Hints for your helper functions.
- Add a feature to filter expenses by Category (e.g., “Show only Food”).
- Bonus: Use the
statisticsmodule to calculate the median expense.
Interactive Practice
Visualize the data flow: User Input -> Python Dict -> JSON File -> Storage.
flowchart LR
User[User Input] --> App[Python Script]
App -- json.dump --> File[finance.json]
File -- json.load --> App
App --> Report[CLI Report]
Quiz
Complete this quiz with a minimum score of 80% to mark Day 28 as complete.
Loading quiz...
Discussion
Have questions or want to discuss this lesson? Join the conversation below!