Learn Lambda Functions by Building an Expense Tracker - Step 12

Tell us what’s happening:

I’m trying to solve this step. It says pass the dictionary as the argument for the .append() method. I suppose that the argument goes inside the () isn’t is ?

Your code so far


# User Editable Region

def add_expense(expenses, amount, category):
    expenses.append({'amount': 2})
    

# User Editable Region


expenses = []

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 12

you need to use the value given in the instructions, do not hardcode the value 2 in there

Thanks for the help. I’m doing the hole course and there was another exercise where I needed to replace the “amount” that was mentioned in the example with a number to make the code work. In this case by writing the word amount (without being an string) instead of a number it worked:

def add_expense(expenses, amount, category):
expenses.append({‘amount’: amount})

Also the other FAQ that I read didn’t specify that. For reason that I wrote this second answer. It may help someone else int he future, Thanks for the support guys :heart: