Learn Lambda Functions by Building an Expense Tracker - Step 18

Python It asks me to sum the map thats what i did and the advice gave me th eanswer clearly i applied it but it still doesnt work. can i have some help pls?

Your code so far

def add_expense(expenses, amount, category):
    expenses.append({'amount': amount, 'category': category})
    
def print_expenses(expenses):
    for expense in expenses:
        print(f'Amount: {expense["amount"]}, Category: {expense["category"]}')
    

/* User Editable Region */

def total_expenses(expenses):
    sum(map(lambda expense: expense['amount'], expenses))

/* 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/119.0.0.0 Safari/537.36 OPR/105.0.0.0

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 18

Hello

You almost have it. You just need to return the result (hint: same line).

return sum(map(lambda expense: expense['amount'], expenses))

still not working

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

That should work. Check the formatting (indentation)?

It’ll definitely work if you fix the indentation.