Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e352335

Browse files
Merge pull request avinashkranjan#2767 from avinashkranjan/deepsource-transform-f577b25b
format code with autopep8
2 parents 687ecf9 + 88f9750 commit e352335

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎Personal Finance Manager/personal_finance_manager.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import matplotlib.pyplot as plt
33
from datetime import datetime
44

5+
56
def track_expenses():
67
date = input("Enter the date (YYYY-MM-DD): ")
78
description = input("Enter the expense description: ")
@@ -11,20 +12,24 @@ def track_expenses():
1112
try:
1213
df = pd.read_csv("expenses.csv")
1314
except FileNotFoundError:
14-
df = pd.DataFrame(columns=["Date", "Description", "Amount", "Category"])
15+
df = pd.DataFrame(
16+
columns=["Date", "Description", "Amount", "Category"])
1517

16-
df = df.append({"Date": date, "Description": description, "Amount": amount, "Category": category}, ignore_index=True)
18+
df = df.append({"Date": date, "Description": description,
19+
"Amount": amount, "Category": category}, ignore_index=True)
1720
df.to_csv("expenses.csv", index=False)
1821

1922
print("Expense added successfully!")
2023

24+
2125
def view_expenses():
2226
try:
2327
df = pd.read_csv("expenses.csv")
2428
print(df)
2529
except FileNotFoundError:
2630
print("No expenses found.")
2731

32+
2833
def generate_spending_report():
2934
try:
3035
df = pd.read_csv("expenses.csv")
@@ -39,12 +44,14 @@ def generate_spending_report():
3944
except FileNotFoundError:
4045
print("No expenses found.")
4146

47+
4248
def set_budget():
4349
budget = float(input("Enter your budget amount: "))
4450
with open("budget.txt", "w") as file:
4551
file.write(str(budget))
4652
print("Budget set successfully!")
4753

54+
4855
def reset_monthly_budget():
4956
now = datetime.now()
5057
first_day_of_month = now.replace(day=1).strftime("%Y-%m-%d")
@@ -53,6 +60,7 @@ def reset_monthly_budget():
5360

5461
print("Monthly budget and expenses reset successfully.")
5562

63+
5664
def check_budget():
5765
try:
5866
with open("budget.txt", "r") as file:
@@ -64,6 +72,7 @@ def check_budget():
6472
except FileNotFoundError:
6573
print("Budget not set. Please set a budget first.")
6674

75+
6776
def visualize_expense_distribution():
6877
try:
6978
df = pd.read_csv("expenses.csv")
@@ -79,6 +88,7 @@ def visualize_expense_distribution():
7988
except FileNotFoundError:
8089
print("No expenses found.")
8190

91+
8292
def main():
8393
while True:
8494
print("\nPersonal Finance Manager Menu:")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /