Tell us what’s happening:
The task is “Now, call map() passing your lambda function as the first argument and the expenses list as the second argument.”
Can you help me to solve this task please?
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"]}')
# User Editable Region
def total_expenses(expenses):
map(lambda expense: expense['amount'], list(expenses))
# User Editable Region
expenses = []
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15
Challenge Information:
Learn Lambda Functions by Building an Expense Tracker - Step 26