Symptom
The large_expense_summary() function returns the correct count of large expenses but the total is always 0.
expenses = [
Expense(200.0, "travel", "Flight", date(2024, 1, 1)),
Expense(150.0, "food", "Dinner", date(2024, 1, 2)),
Expense(50.0, "food", "Lunch", date(2024, 1, 3)),
]
result = large_expense_summary(expenses, threshold=100.0)
# result = {"count": 2, "total": 0, "threshold": 100.0}
# ^ should be 350.0!
What you know
The function calls get_large_expenses() to find expenses above the threshold, then counts them and sums their amounts. The count is correct but the total is zero.
Hints
Python
Python ready
Test Output
▶
Click "Run Tests" to execute your code