Back to Freecodecamp

Step 11

curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/65821fcc010c3245718f2a06.md

latest829 B
Original Source

--description--

The expenses parameter of your add_expense function will be a list of expenses. You want to be able to add items at the end of your list. For that you'll use the .append() list method.

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

--hints--

You should have expenses.append() in your function.

js
({ test: () => assert(runPython(`_Node(_code).find_function("add_expense").has_stmt("expenses.append()")`)) })

You should not have pass in your function.

js
({ test: () => assert.isFalse(runPython(`_Node(_code).find_function("add_expense").has_pass()`)) })

--seed--

--seed-contents--

py
--fcc-editable-region--
def add_expense(expenses, amount, category):
    pass
--fcc-editable-region--

expenses = []