How do I construct a loop for my input statements? Input question is, "What type of coffee would you like today?" If user selects a coffee, they pass, but if they fail, they must retry.
order = input("\n" + first_name.capitalize() + "," " " + "What type of Coffee would you like today?\n\n" +
"\n".join(["Expresso", "Latte", "Cappuccino", "Mocha", "Frappuccino"]) + "\n\n")
order = order.replace("and a", "")
order = order.replace("and", "")
order = order.replace(",", "")
order = order.lower().split()
union = " and a " if len(order) > 1 else ""
plural = "" if len(order) > 1 else ""
order = input("\nYou have selected a" + " " + ", ".join(order[:-1]).title() + union + plural + order[-1].title()
+ "!" + " " + "\n\nIs this correct?\n\n")
i = 0
list1 = ['expresso', 'latte', 'cappucino', 'Mocha' ]
while i:
input1 = input('What type of coffee do you have')
if input1 in list1:
break
Comments
Leave a comment