-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (28 loc) · 988 Bytes
/
main.py
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
from tracker import Tracker
from summary import show_summary
def main():
tracker = Tracker()
while True:
print("\n--- Personal Finance Tracker ---")
print("1. Add Income")
print("2. Add Expense")
print("3. Show Summary")
print("4. Exit")
choice = input("Choose an option: ")
if choice == "1":
amount = float(input("Enter income amount: "))
description = input("Enter income description: ")
tracker.add_income(amount, description)
elif choice == "2":
amount = float(input("Enter expense amount: "))
description = input("Enter expense description: ")
tracker.add_expense(amount, description)
elif choice == "3":
show_summary(tracker)
elif choice == "4":
print("Goodbye!")
break
else:
print("Invalid option. Please try again.")
if __name__ == "__main__":
main()