-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpenseTracker.py
More file actions
57 lines (46 loc) · 1.67 KB
/
Copy pathExpenseTracker.py
File metadata and controls
57 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Expense Tracker Project
expensesList = [] #list of expenses in form of dictionary
print("Welcome to Expense Tracker : Spend Smart and Track Everything before it disappears.")
while True:
print("===== MENU =====")
print("1. Add Expense")
print("2. View All Expenses")
print("3. View Total Expenses Spent")
print("4. Exit")
choice = int(input("Please Enter Your Choice : "))
#Add Expense
if(choice == 1):
date = input("Date of spent expense : ")
catagory = input("Which type of expenses? (Food,Travel,Books,Other...) : ")
description = input("Give more details (Where,What) : ")
amount = float(input("Enter the amount : "))
expense = {
"date":date,
"catagory":catagory,
"description":description,
"amount":amount
}
expensesList.append(expense)
print("DONE.Expense is added successfully.")
# View Expenses
elif(choice == 2):
if(len(expensesList)==0):
print("No Expenses Added.")
else:
print("=== View Your All Expenses ===")
count=1
for eachExpense in expensesList:
print(f"Expense Number {count} -> {eachExpense["date"]},{eachExpense["catagory"]},{eachExpense["description"]},{eachExpense["amount"]} ")
count += 1
# View Total Spending
elif(choice == 3):
total=0
for eachExpense in expensesList:
total = total + eachExpense["amount"]
print("TOTAL EXPENSE = ",total)
# EXIT
elif(choice == 4):
print("THANK YOU for using our system.")
break
else:
print("INVALID CHOICE.TRY AGAIN.")