curriculum/challenges/english/blocks/learn-lambda-functions-by-building-an-expense-tracker/65824872894f59546e3084e2.md
The while loop you created in the previous step is an infinite loop that will allow the program to continuously present menu options until the user decides to exit.
After the print() call, add another print() call to print the string '1. Add an expense'.
You should print '1. Add an expense' within your while loop after the existing print() call.
({ test: () => assert(runPython(`
call_lst = _Node(_code).find_function("main").find_whiles()[0].find_bodies()[0].find_calls("print")
test_lst = ["print('\\\\nExpense Tracker')", "print('1. Add an expense')"]
all(call_lst[n].is_equivalent(i) for n, i in enumerate(test_lst))
`)) })
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)
def main():
expenses = []
--fcc-editable-region--
while True:
print('\nExpense Tracker')
--fcc-editable-region--