Learn Lambda Functions by Building an Expense Tracker - Step 29

Tell us what’s happening:

Hello, I’m stuck here.
I don’t know how to write the lambda function.
I couldn’t find anything suitable in the forum either.
I hope you can help me?!

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))
    

# User Editable Region

def filter_expenses_by_category(expenses, category):
    filter(lambda expense, expenses: expense['category'] == category)

# User Editable Region


expenses = []

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 29

did you add a lambda function as requested? and only that?

Yes, but it doesn’t work. :frowning:

in your code there is more than just a lambda function