Menu
Coddy logo textTech

Exit The Program

Part of the Fundamentals section of Coddy's Python journey — lesson 69 of 77.

challenge icon

Challenge

Easy

Now let's create the actual program!

  1. Create an infinite while loop (refer the hint if not sure how to do so)
  2. In each iteration of the loop, get input from the user, this will be the choice (1 - 5 from the menu)
  3. Handle the first case, if the choice is equal to 5, exit the program (loop) and output:
Exiting the Daily Expense Tracker. Goodbye!

Try it yourself

print("Welcome to the Daily Expense Tracker!")

# Display menu once
print("\nMenu:")
print("1. Add a new expense")
print("2. View all expenses")
print("3. Calculate total and average expense")
print("4. Clear all expenses")
print("5. Exit")

All lessons in Fundamentals