Learn Lambda Functions by Building an Expense Tracker - Step 26

Tell us what’s happening:

my print call seems t be wrong, the console is not passing me through
print(map(lambda expense: expense[‘amount’],))

  1. You should call the map() function inside the total_expenses function.

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):
    print(map(lambda expense: expense['amount'],))

# User Editable Region


expenses = []

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 26

Are you trying to just print the result or are you trying to pass the step? (bc the instructions don’t ask for print, so it won’t pass the test)

If you want to test the output and look at it you will need to call the function that you’ve defined. Keep in mind that you’ll need to call it after defining the expenses variable if you want to pass that as an argument

I am trying to pass the step, this is what is asked : Now, call map() passing your lambda function as the first argument and the expenses list as the second argument.

as @pkdvalis said, you are not being asked to print the result of map, you just need to use map function and pass it the arguments.

you also have to give the map function a list as its second argument.