Learn Lambda Functions by Building an Expense Tracker - Step 11

Tell us what’s happening:

Add a call to the .append() method on the expenses list. Don’t pass any arguments to .append() for now.

Help! I’m stuck here…
i’ve tried expenses.append() but it doesn’t work

Your code so far


# User Editable Region

def add_expense(expenses, amount, category):
    pass

# User Editable Region

expenses.append()
expenses = []

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 11

the thing you have written is correct on its own, but you need to be writing the body of the add_expense function, so you need to be writing inside the function

@ShellPy Great job so far, and welcome to the fCC community.
You are half way there. You’re almost done, you just need to place the append() method call inside the function.

Currently, you have:

However, this line needs to be within the function to work correctly. Here’s what you can do:

  1. Replace “pass” (the pass statement) with your method call that you figured out. “pass” is just a code placeholder.
  2. Focus on indentation. Indentation is important in Python. Improper indentation makes it call outside of the function scope, so be careful about this in the future to prevent errors.

-Happy Coding