Exercise 8: A Shopping-List Menu — Possible Solution ==================================================================== items = [] while True: print() print("1) Add item 2) Show list 3) Quit") choice = input("Choose: ") if choice == "1": items.append(input("Item: ")) elif choice == "2": if items: for number, item in enumerate(items, start=1): print(f" {number}. {item}") else: print(" (empty)") elif choice == "3": break else: print("Please choose 1, 2 or 3") print(f"Goodbye! You had {len(items)} items.") Example run: 1) Add item 2) Show list 3) Quit Choose: 2 (empty) 1) Add item 2) Show list 3) Quit Choose: 1 Item: milk 1) Add item 2) Show list 3) Quit Choose: 1 Item: eggs 1) Add item 2) Show list 3) Quit Choose: x Please choose 1, 2 or 3 1) Add item 2) Show list 3) Quit Choose: 2 1. milk 2. eggs 1) Add item 2) Show list 3) Quit Choose: 3 Goodbye! You had 2 items. WHY THIS WORKS AS AN ANSWER ------------------------------ The only break is in the quit branch, directly inside the while loop, so it ends the menu. The for loop that prints the list has no break of its own: it runs to the end each time and the menu comes round again. If a break were placed inside that for loop it would only stop the printing, not the menu. Any other input falls to the final else, which prints a message and lets the loop repeat.