Learn Lambda Functions by Building an Expense Tracker - Step 17

Tell us what’s happening:

I will need help to solve step 17. I have try interpreting the instruction and have the following :
return (lambda expense: expense[‘amount’], expenses)

Is there anything that I missed? Please help

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):
    return (lambda expense: expense['amount'], 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/17.5 Safari/605.1.15

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 17

Replace pass with a lambda function that has expense as its parameter.

You need only the lambda function to pass this step. Remove the unnecessary parts and you’ll be able to pass.

I applied your advice and pass the test. Thanks.

1 Like