curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/65823ff0d4b991510fade1a8.md
Within the filter_expenses_by_category function, replace pass with a lambda function. Use expense as the parameter and evaluate the comparison between the value of the 'category' key of the expense dictionary and category using the equality operator.
You should create a lambda function that uses a parameter named expense and evaluates the expression expense['category'] == category inside the filter_expenses_by_category function.
({ test: () => assert(runPython(`_Node(_code).find_function("filter_expenses_by_category").has_stmt("lambda expense: expense['category'] == category")`)) })
You should not have pass inside the filter_expenses_by_category function.
({ test: () => assert.isFalse(runPython(`_Node(_code).find_function("filter_expenses_by_category").has_pass()`)) })
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))
--fcc-editable-region--
def filter_expenses_by_category(expenses, category):
pass
--fcc-editable-region--
expenses = []