Tell us what’s happening:
issue with the non writable part :
return sum(map(lambda expense: expense[‘amount’], expenses))
észzzqwssezddeszqwsze"z"wzsqedzsdsqwxwzqsa"ssssssssssssssssssssssssssssqszzzz #here !
def filter_expenses_by_category(expenses, category):
filter(lambda expense: expense[‘category’] == category, expenses)
return filter(filter_expenses_by_category)
Your code so far
def add_expense(expenses, amount, category):
expenses.append({'amount': amount, 'category': category})
def print_expenses(expenses):
for expense in expenses:
print(f'Amount: {expense["amount"]}, Category: {expense["category"]}')
def total_expenses(expenses):
return sum(map(lambda expense: expense['amount'], expenses))
észzzqwssezddeszqwsze"z"wzsqedzsdsqwxwzqsa"ssssssssssssssssssssssssssssqszzzz
# User Editable Region
def filter_expenses_by_category(expenses, category):
filter(lambda expense: expense['category'] == category, expenses)
# User Editable Region
expenses = []
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0
Challenge Information:
Learn Lambda Functions by Building an Expense Tracker - Step 22