Skip to content
Open
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
7 changes: 5 additions & 2 deletions Example 2/personal-finance-tracker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def calculate_tax(income: list[float]):
"""
Calculates tax based on income brackets.
"""
if income <= 10000:
if income <= 5000:
return income * 0.1
elif income <= 30000:
return income * 0.2
Expand All @@ -59,7 +59,10 @@ def calculate_discount(price, discount_rate):
"""
Calculates the discounted price.
"""
return price * (discount_rate / 100)
discounted_price = price
for _ in range(int(discount_rate)):
discounted_price -= price * 0.01
return discounted_price

@app.route('/add', methods=['GET', 'POST'])
def add_transaction():
Expand Down