Develop a console-based Expense Tracker application in Python that allows users to monitor and manage their daily expenses. This project will help you practice fundamental Python concepts such as data structures, file handling, user input, and functions.
- Functionality: Allow users to input new expenses with the following details:
- Amount: A positive number representing the cost.
- Category: Select from predefined categories (e.g., Food, Transportation, Entertainment, Utilities, Others).
- Description: A brief description of the expense.
- Date: The date of the expense in
YYYY-MM-DD
format. If not provided, default to the current date.
- Functionality: Display a list of all recorded expenses in a clear, tabular format showing:
- Amount
- Category
- Description
- Date
- Functionality: Provide a summary that includes:
- Total expenses per category.
- Overall total expenses.
- Functionality:
- Save all expenses to a JSON file (e.g.,
expenses.json
) to ensure data is retained between program runs. - Load existing expenses from the JSON file when the application starts.
- Save all expenses to a JSON file (e.g.,
- Functionality: Implement a simple text-based menu that allows users to navigate between different functionalities:
- Add Expense
- View Expenses
- Summary Report
- Exit
- Functionality: Ensure that all user inputs are validated:
- Amount: Should be a positive number.
- Category Selection: Should be within the predefined options.
- Date: Should follow the
YYYY-MM-DD
format. - Handle invalid inputs gracefully by displaying appropriate error messages.
- Date Range Filtering: Allow users to view expenses within a specific date range.
- Graphical Reports: Use libraries like
matplotlib
to visualize spending trends with charts or graphs. - User Authentication: Implement user accounts to manage expenses for different individuals.
- Recurring Expenses: Handle expenses that occur regularly (e.g., monthly subscriptions).
- Export Data: Provide an option to export expenses to formats like CSV or Excel.
- Programming Language: Python (version 3.x)
- Data Storage: JSON file for saving and loading expenses.
- Libraries: You may use Python's standard libraries such as
json
,os
, anddatetime
. For optional enhancements like graphical reports, you can use external libraries likematplotlib
. - Code Structure:
- Use functions to organize different parts of the application (e.g., adding an expense, viewing expenses, generating reports).
- Keep the code modular and readable with proper naming conventions and comments.
- Requirement: Submit the Python script (
.py
file) containing your Expense Tracker application. - Note: Ensure that your code is well-documented with comments explaining key sections and functionalities.
- Requirement: Include a brief README file that describes:
- How to run the application.
- Any external libraries used (if applicable).
- Features implemented, including any optional enhancements.
- Optional: Provide sample screenshots or a short video demonstrating the application's functionalities.
- Functionality: The application meets all the required features and works as expected.
- Code Quality: Code is clean, well-organized, and follows best practices.
- User Experience: The interface is user-friendly, and inputs/outputs are handled gracefully.
- Error Handling: The application properly manages invalid inputs and unexpected errors.
- Creativity: Implementation of optional enhancements and any additional useful features.
-
Plan Your Project:
- Outline the features you want to implement.
- Break down the project into smaller tasks (e.g., creating the menu, handling user input, managing data storage).
-
Start Small:
- Begin with the core functionalities like adding and viewing expenses before moving on to summary reports and data persistence.
-
Test Frequently:
- Regularly test each feature as you build to ensure everything works correctly.
-
Seek Feedback:
- Share your progress with peers or mentors to get constructive feedback and suggestions.
-
Explore Documentation:
- Familiarize yourself with Python’s
json
,os
, anddatetime
modules to effectively handle data storage and date operations.
- Familiarize yourself with Python’s
Example Workflow
1. Launch Application
2. Add an Expense
3. View Expenses
4. Summary Report