Tell us what’s happening:
Even if I do what the instructions tell me to do it appears as if my code had an indentation error.
These are the instructions:
Below the expenses
list, create a while
loop. Use True
for the condition, and print the string '\nExpense Tracker'
inside the loop body to show the title of the program.
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):
return sum(map(lambda expense: expense['amount'], expenses))
def filter_expenses_by_category(expenses, category):
return filter(lambda expense: expense['category'] == category, expenses)
# User Editable Region
def main():
expenses = []
while true:
print("\nExpense Tracker")
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Challenge Information:
Learn Lambda Functions by Building an Expense Tracker - Step 24