Back to Freecodecamp

Step 16

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

latest986 B
Original Source

--description--

Next, you are going to display the details for each expense.

Inside the for loop, replace pass with a print() call and pass it the following f-string: f'Amount: {expense}, Category: {expense}'.

--hints--

You should print f'Amount: {expense}, Category: {expense}' in your for loop.

js
({ test: () => assert(runPython(`_Node(_code).find_function("print_expenses").find_for_loops()[0].has_call("print(f'Amount: {expense}, Category: {expense}')")`)) })

You should not have pass inside your loop body.

js
({ test: () => assert.isFalse(runPython(`_Node(_code).find_function("print_expenses").find_for_loops()[0].find_bodies()[0].has_pass()`)) })

--seed--

--seed-contents--

py
def add_expense(expenses, amount, category):
    expenses.append({'amount': amount, 'category': category})
    
--fcc-editable-region--
def print_expenses(expenses):
    for expense in expenses:
        pass
--fcc-editable-region--

expenses = []