Learn Lambda Functions by Building an Expense Tracker - Step 12

Tell us what’s happening:

I am having trouble getting this one to pass. I have tried different indentations and nothing has worked so far.

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"]}')

def total_expenses(expenses):
    pass
    

# User Editable Region

test = lambda x: x * 2
    test(3):
        print(test(3))

# User Editable Region


expenses = []

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Lambda Functions by Building an Expense Tracker - Step 12

Hey @Toastnjam, and welcome to the FCC Community!

All you need to do is call print(test(3)). That is it! You won’t indent anything because the print command you’re calling isn’t a part of any other statement except for the main body of the Python script.

Thank you!

It is still not working for me. Both lines are indented 4 spaces:

test = lambda x: x * 2
    test(3):
    print(test(3))

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

I would refer to this advice

Thank you, @pkdvalis, for that! I messaged him and got it solved.