Learn Lambda Functions by Building an Expense Tracker - Step 18

Tell us what’s happening:Hi everyone, total newbie here (hence taking the course) but it would appear that I am relly missing something simple. From the hint answer given by free code camp it would suggest that my logic is sound.

I am very aware that I have been making small typos that are easily missed in prior sections, as such I have coppied and pasted the SHOULD READ code.

But I am still being told sorry the code does not pass and am unable to proceed.
I assumed this step was very simple and I simply needed to pass the prior body through the sum() function. It even reads this way on the hint, so what am I missing?

Any help gratefully and humbly recieved and if I have done something super silly well atleast I will know.

Thnks so much.

Your code so far


def total_expenses(expenses):
    sum(map(lambda expense: expense['amount'], expenses))
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; rv:122.0) Gecko/20100101 Firefox/122.0

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 18

There are two things to do in this step:

  • Add sum()
  • return the result

The first part you have, now is left the second one.

3 Likes

Oh dear :rofl::rofl:
Thanks for the help! :+1:

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.