Simple Expense Logger
1. Introduction
This report describes a Python-based Expense Tracker Program designed
to help users record, view, and analyze their daily expenses. The program
uses basic Python concepts such as functions, conditional statements, loops,
file handling, and user input. It stores expense data permanently in a text
file, allowing the user to manage expenses over time.
2. Objective of the Program
The main objectives of this program are:
To allow users to add expense records with date and time
To store expenses in a file for future reference
To display all saved expenses
To calculate and display total expenses
To demonstrate practical usage of Python file handling and functions
3. Description of the Program
The program is menu-driven and continuously runs until the user chooses to
exit. It consists of two user-defined functions:
tkdate() – for taking and validating date input
tktime() – for taking and validating time input
Expense records are stored in a file named [Link] in comma-
separated format.
4. Algorithm
Step 1: Start the program
Step 2: Display menu options
1. Add Expense
2. View Expenses
3. Show Total
4. Exit
Step 3: Accept user choice
Step 4: Perform operations based on choice
Option 1: Take expense amount, category, date, and time → store in
file
Option 2: Read and display all expense records
Option 3: Calculate and display total expenses
Option 4: Exit the program
Step 5: Repeat until exit option is selected
5. Function Explanation
5.1 tkdate() Function
Takes date, month, and year as input
Checks for valid date and month range
Returns the date in dd/mm/yyyy format
5.2 tktime() Function
Takes hours and minutes as input
Validates time range (00:00 to 23:59)
Returns the time in hh:mm format
6. File Handling
File Name: [Link]
Write Mode (``********************): Used to append new expense
records
Read Mode (``********************): Used to view expenses and
calculate totals
File Format:
Amount,Category,Date,Time
Example:
250,Food,Date=12/10/2025,Time=14:30
7. Output
Sample Menu Display:
1. Add Expense
2. View Expenses
3. Show Total
4. Exit
Sample Expense Display:
Date=12/10/2025 | Time=14:30 | ₹250 | Food
Total Expense Output:
Your total expenses: 1250
8. Advantages
Simple and easy to use
Uses basic Python concepts
Permanent data storage using files
Menu-driven interface
9. Limitations
Limited input validation for dates and time
No delete or edit option for expenses
File may cause error if not present initially
Not suitable for large-scale expense management
10. Future Enhancements
Improve date and time validation
Add delete and edit expense options
Implement category-wise expense summary
Use a database instead of a text file
Add graphical user interface (GUI)
11. Conclusion
The Python Expense Tracker Program is a beginner-friendly application that
effectively demonstrates how Python can be used for real-life problem
solving. It provides hands-on experience with functions, loops, conditions,
and file handling, making it ideal for academic projects and practical
assignments.
End of Report