Feb-09-2018, 10:40 PM
(This post was last modified: Feb-09-2018, 10:40 PM by TimeForged.)
So I am trying to figure out how to display a menu in the current code where it prompts the user to display a menu like this
please choose a flavor
1.Savanah
2.Tagalong
3.Thinmints
where I am confused is I'm trying to capture the numerical input from the user, so if they enter 1 that means they selected the first flavor, then they tell me how many and what not. Here is what I have so far. I'm new to python this is my fifth week.
please choose a flavor
1.Savanah
2.Tagalong
3.Thinmints
where I am confused is I'm trying to capture the numerical input from the user, so if they enter 1 that means they selected the first flavor, then they tell me how many and what not. Here is what I have so far. I'm new to python this is my fifth week.
#Input print("Hello welcome to my store") print() order_total = 0 item_cnt = 0 1 = int(input("Savanah") 2 = int(input("ThinMints") 3 = int(input("Tagalongs") cont = input("Would you like to start? (y/n)>") print('-' * 30) print('order for your name') print('Item Name Price Qty total') while cont.lower() == "y": input("Please choose a flavor {} {} {}".format(1, 2, 3)) item_name = input("Enter cookie name>") item_price = int(input("enter item price>")) item_qty = int(input("enter item quanity>")) #Process item_total = (item_qty * item_price) order_total += order_total + item_total item_cnt += 1 #Output print("{}.{} price:${} qty:{} total:${}.".format(item_cnt, item_name,item_price, item_qty, item_total)) print("There are {} items in the order for a total of ${}".format(item_qty, item_total)) cont = input("would you like to start another order? (y/n))") print("You ordered {} items for a total price of ${}".format(item_cnt, order_total)) print("Thank you for your order") print() print("Thank you for using this program")