[Tutor] Python Help - While Loops
Tyson Barber
tysonwbarber at gmail.com
Wed Nov 13 12:50:36 EST 2019
Hello Tutor,
I am currently trying to make a online purchasing system where someone can
choose certain types of donuts to buy. I had no issue with them only buying
one type, but I am not too familiar with loops, and I cannot seem to find
any examples of such online. I just want the menu to reappear after they
buy one option. My code so far looks like this:
print ("Welcome to The Donut Shop!")
shopping = input ("To start shopping, press s. To leave the store, press
q.")
while shopping == s:
name = (input("Please enter your name to begin: ")
print ("Please select a donut from the menu: ")
print ("1. Chocolate")
print ("2. Honey Crueller")
print ("3. Apple Fritter")
print ("4. Boston Cream")
donut = int(input ("Please select a number from 1 to 5: ")
under that I have a line to ask the quantity of what donut, and a equation
for the price, which calculates the total, but it only works for one time.
How would I properly create the while loop so that it does not keep giving
me errors in the while statement?
Thank you,
Tyson
More information about the Tutor
mailing list