Computer Project Latest - Removed
Computer Project Latest - Removed
"\nAmount:",row[2],"\nCategory:",row[3], "\
nDescription:",row[4]) print("\n") except
FileNotFoundError:
print("No entries yet. File not found.\n")
try:
# Read the file and analyze the expenses
with open('expenses.csv', 'r') as file:
reader = csv.reader(file)
rows = list(reader)
if len(rows) == 0:
print("No entries yet.\
n") else: for row
in rows:
transaction_type = row[1].lower() # Make the type case-
insensitive if transaction_type == "expense": # Only process
expenses category = row[3] amount =
float(row[2]) if category in categories:
categories[category] += amount
else:
categories[category] = amount
if len(categories) == 0: