curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/65823cfc74aa564ffc460489.md
Now, call map() passing your lambda function as the first argument and the expenses list as the second argument.
You should call the map() function inside the total_expenses function.
({ test: () => assert(runPython(`len(_Node(_code).find_function("total_expenses").find_calls("map")) == 1`)) })
You should pass your lambda function as the first argument to the map() call.
({ test: () => assert(runPython(`_Node(_code).find_function("total_expenses").find_calls("map")[0].find_call_args()[0].is_equivalent("lambda expense: expense['amount']")`)) })
You should pass the expenses list as the second argument to the map() call.
({ test: () => assert(runPython(`_Node(_code).find_function("total_expenses").find_calls("map")[0].find_call_args()[1].is_equivalent("expenses")`)) })
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"]}')
--fcc-editable-region--
def total_expenses(expenses):
lambda expense: expense['amount']
--fcc-editable-region--
expenses = []