Lazo Lab Sign up

App 2: To-Do List Manager / Build the to-do app

Lesson 2 of 10

The menu loop

A while True loop shows the menu, reads a choice and runs the matching code. Choosing quit breaks out of the loop.

Key points

  • while True keeps the app running
  • break ends the loop
  • Unknown choices get a friendly message
while True:
    print("\n1. Add  2. List  3. Done  4. Delete  5. Quit")
    choice = input("> ").strip()
    if choice == "5":
        print("Bye!")
        break
    else:
        print("Pick a number from 1 to 5.")

Your turn

Get the menu loop running so typing 5 quits.

Watch a video on thisOpens YouTube search results for “The menu loop” in a new tab

Quiz · +10 XP

What makes the menu stop?

Log in to save progress and earn XP.