Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Projects/Expense Tracker/expense_tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class ExpenseTracker:
def __init__(self):
self.expenses = {}
self.categories = {}

def add_expense(self, date, amount, category):
if category not in self.expenses:
self.expenses[category] = []
self.expenses[category].append((date, amount))

def add_category(self, category):
if category not in self.categories:
self.categories[category] = 0

def view_expenses(self):
for category, items in self.expenses.items():
total_amount = sum(amount for _, amount in items)
print(f"{category}: ${total_amount}")

def view_categories(self):
print("Categories:")
for category in self.expenses.keys():
print(category)

# Sample usage
tracker = ExpenseTracker()

while True:
print("\nExpense Tracker Menu:")
print("1. Add Expense")
print("2. Add Category")
print("3. View Expenses")
print("4. View Categories")
print("5. Exit")

choice = input("Enter your choice: ")

if choice == "1":
date = input("Enter date (YYYY-MM-DD): ")
amount = float(input("Enter amount: $"))
category = input("Enter category: ")
tracker.add_expense(date, amount, category)
elif choice == "2":
category = input("Enter category: ")
tracker.add_category(category)
elif choice == "3":
tracker.view_expenses()
elif choice == "4":
tracker.view_categories()
elif choice == "5":
print("Exiting Expense Tracker. Goodbye!")
break
else:
print("Invalid choice. Please try again.")
56 changes: 56 additions & 0 deletions Projects/Expense Tracker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Expense Tracker

Expense Tracker is a Python application designed to help users keep track of their daily expenses. It provides a simple and intuitive interface for recording expenses, categorizing them, and viewing summaries based on categories.

## Features

- **Add Expense:** Users can input the date, amount, and category of their expenses. The expenses are stored and categorized for future reference.

- **Add Category:** Users can create new categories to classify their expenses, ensuring a customized tracking experience.

- **View Expenses:** Users can view the total expenses for each category, helping them understand where their money is going.

- **View Categories:** Users can view a list of available categories, making it convenient to track expenses related to specific areas of their life.

## Usage

1. **Add Expense:**
- Select option 1 from the menu.
- Enter the date of the expense in the format `YYYY-MM-DD`.
- Enter the amount of the expense.
- Enter the category of the expense.

2. **Add Category:**
- Select option 2 from the menu.
- Enter the name of the new category.

3. **View Expenses:**
- Select option 3 from the menu.
- The application will display the total expenses for each category.

4. **View Categories:**
- Select option 4 from the menu.
- The application will display a list of available categories.

5. **Exit:**
- Select option 5 from the menu to exit the Expense Tracker application.

## Dependencies

This application requires Python to run. No external libraries are used, making it easy to set up and run on any system with Python installed.

## How to Run

1. Ensure you have Python installed on your system.

2. Download the `expense_tracker.py` file from this repository.

3. Open a terminal or command prompt and navigate to the directory where `expense_tracker.py` is saved.

4. Run the following command:

python expense_tracker.py


5. Follow the on-screen instructions to use the Expense Tracker.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ You can contribute too! :smile:
33. **Face Recognition Program** - A simple face recognition program
![ss](https://github.com/Sj0605-DataSci/screeenshots/blob/main/Screenshot%202022-10-04%20at%201.18.15%20AM.png)

34. **Expense Tracker** - Application to help users track their expenses. Users can input their daily expenses, categorize them, and view monthly/yearly summaries.


## Can I contribute?

Expand Down