Learn Lambda Functions by Building an Expense Tracker - Step 11

I can’t figure out how to do this step.

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

# User Editable Region

test = lamba 5: x * 2
print(test(3))

# User Editable Region


expenses = []

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 11

your lambda function needs a parameter. If you want to return x * 2 you need to use x before the colon.

1 Like