# why wont this repeat for different costumers/people, with them entering multiple items per order?

0 votes
asked Feb 14, 2018
edited Feb 14, 2018
import math
big_mac_meal=1
quarter_pounder_meal=2
chicken_nuggets_meal_1=3
chicken_nuggets_meal_2=4
apple_pie=5
large_drink=6
large_fries=7
tax=.0565
total=0
items=0
total_items=0
sales=0
customer_total=0
order=0
total_tax=0
print ("item:                Meal/item:                             price:")
print (" 1                   Big Mac Meal                           4.87")
print (" 2                   Quarter Pounder Meal                   5.03")
print (" 3                   Chicken Nuggets meal ( 5 piece)        5.50")
print (" 4                   Chicken Nuggets meal (10)              9.45")
print (" 5                   Apple Pie                              1.29")
print (" 6                   Large Drink                            2.19")
print (" 7                   Large Fries                            2.29")
item=int(input("Enter the item you want or -1 to end order or -2 to end shift"))
quantity=int(input("enter the amount you want"))
while item!=-2:
while item!=-1:

if item==1:
price=4.87
sub_total1=price*quantity
total=total+sub_total1
items=items+quantity

print (quantity,"big mac meals",sub_total1)
elif item==2:
price=5.03
sub_total2=price*quantity
total=total+sub_total2
items=items+quantity

print (quantity,"Quarter pounder meals",sub_total2)
elif item==3:
price=5.50
sub_total3=price*quantity
total=total+sub_total3
items=items+quantity

print (quantity,"Chicken Nugget meals(5 piece)",sub_total3)
elif item==4:
price=9.45
sub_total4=price*quantity
total=total+sub_total4
items=items+quantity

print (quantity,"Chicken Nugget meals(10 piece)",sub_total4)
elif item==5:
price=1.29
sub_total5=price*quantity
total=total+sub_total5
items=items+quantity

print (quantity,"Apple Pie",sub_total5)
elif item==6:
price=2.19
sub_total6=price*quantity
total=total+sub_total6
items=items+quantity

print (quantity,"Large Drink", sub_total6)
elif item==7:
price=2.29
sub_total7=price*quantity
total=total+sub_total7
items=items+quantity

print (quantity,"Large Fries", sub_total7)
else:

print ("item:                Meal/item:                             price:")
print (" 1                   Big Mac Meal                           4.87")
print (" 2                   Quarter Pounder Meal                   5.03")
print (" 3                   Chicken Nuggets meal ( 5 piece)        5.50")
print (" 4                   Chicken Nuggets meal (10)              9.45")
print (" 5                   Apple Pie                              1.29")
print (" 6                   Large Drink                            2.19")
print (" 7                   Large Fries                            2.29")
item=int(input("Enter the item you want or -1 to end order or -2 to end shift"))
quantity=int(input("enter the amount you want"))
total_items=total_items+items
customer_total=customer_total+1
taxes=total*tax
final_order=total+taxes
sales=sales+total
order=order+final_order
total_tax=total_tax+taxes

print ("item:                Meal/item:                             price:")
print (" 1                   Big Mac Meal                           4.87")
print (" 2                   Quarter Pounder Meal                   5.03")
print (" 3                   Chicken Nuggets meal ( 5 piece)        5.50")
print (" 4                   Chicken Nuggets meal (10)              9.45")
print (" 5                   Apple Pie                              1.29")
print (" 6                   Large Drink                            2.19")
print (" 7                   Large Fries                            2.29")
item=int(input("Enter the item you want or -1 to end order or -2 to end shift"))
quantity=int(input("enter the amount you want"))
items=0

print ("total customers:",customer_total)
print ("sales without tax:",sales)
print ("sales with tax:",total_tax)
print ("items sold:",total_items)

## 2 Answers

+1 vote
answered Apr 25, 2018 by Rahl
if you want code to repeat itself you need loops. Try a while loop. The magic of if statements is that they are ran only once, but when inside a while loop, they are ran so long the check is true.
0 votes
answered Feb 19, 2020 by (970 points)

This should do the trick:

https://onlinegdb.com/Hk-g26tmI