Learn Lambda Functions by Building an Expense Tracker - Step 4

Tell us what’s happening:

I got stuck with this one is there modifications that i can do

Your code so far


# User Editable Region

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

# 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/127.0.0.0 Safari/537.36

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 4

Hi @ajayreddyyamala,

The test is just looking for a certain setup with this one. We can create dictionaries without assigning them to a variable name. For example:

{'key': value}

This is a dictionary. We can pass this dictionary inside the append() call like so:

something.append({'key': value})

I hope this helps. Happy coding!

1 Like