Files
Learn-Python-Programming-Th…/ch03/menu.no.walrus.py
T
adii1823 8b802c5c62 ch03
2021-10-28 17:34:45 +05:30

14 lines
289 B
Python

flavors = ["pistachio", "malaga", "vanilla", "chocolate", "strawberry"]
prompt = "Choose your flavor: "
print(flavors)
while True:
choice = input(prompt)
if choice in flavors:
break
print(f"Sorry, '{choice}' is not a valid option.")
print(f"You chose '{choice}'.")