import random import time 
print ("Welcome to Pizza Shed!")
total_cost = 0
tablenum = input ("Enter table number from 1-25 \n ")tablenum = 
int(tablenum)while tablenum>25 or tablenum <=0:     tablenum = input ("Enter 
the correct table number, there are only 25 tables ")     #Pizza menu with 
prices 
print ("---------------------") 
print ("Let me help you with your order!") 
print ("---------------------") 
print ("Menu") 
print (     "1 = cheese and tomato: 3.50, "     "2 = ham and pineapple: 4.20, " 
    "3 = vegetarian: 5.20, "     "4 = meat feast: 5.80, "     "5 = seafood: 
5.60 " )
pizza_costs = [3.5,4.2,5.2,5.8,5.6]
pizza_choice = input("Enter the type of pizza that you want to order from 1-5 
\n") pizza_choice = int(pizza_choice)while pizza_choice>5 or pizza_choice <=1:  
   pizza_choice = input ("Enter the right number ") 
if pizza_choice == 1:     print "You have chosen cheese and tomato. The cost 
for this is 3.50" elif pizza_choice == 2:     print ("You have chosen ham and 
pineapple. The cost for this is 4.20") elif pizza_choice == 3:     print ("You 
have chosen vegetarian. The cost for this is 5.20") elif pizza_choice == 4:     
print ("You have chosen meat feast. The cost for this is 5.80") elif 
pizza_choice == 5:     print ("You have chosen sea food. The cost for this is 
5.60")
#find the cost and then add it to the #totalcost = pizza_costs[pizza_choice - 
1]total_cost += cost    print ("------------------") 
pizza_amount = input ("Enter the amount of Pizzas that you want to order ") 
while pizza_amount > 10 or pizza_amount <=0:     pizza_amount = input ("Maximum 
amount is 10, Please enter again ") 
print ("--------------------") 
#base 
print ("Base") 
print (     "1 = thin and crispy,"     "2 = traditional" ) 
base = input ("Select a base from 1-2 \n") while base>2 or base<=1:     base = 
input ("There are only 2 types, Please enter again ") 
if base == 1:     print "You have chosen thin and crispy" elif base == 2:     
print ("You have chosen traditional")     print ("-------------------") 
#extra toppings 
print ("Extra Toppings") 
toppings = input ("Enter a number for your choice of extra topping \n Enter 1 
for extra cheese \n Enter 2 for extra pepperoni \n Enter 3 for extra pineapple 
\n Enter 4 for extra peppers \n" ) while toppings >4 or toppings < 0:     
toppings = input ("There are only 4 types of extra toppings, Please try again " 
) 
if toppings == 1:     print ("You have chosen extra cheese. The cost for this 
is 0.50") elif toppings == 2:     print ("You have chosen pepperoni. The cost 
for this is 0.50") elif toppings == 3:     print ("You have chosen pineapple. 
The cost for this is 0.50") elif toppings == 4:     print ("You have chosen 
peppers. The cost for this is 0.50") 
print ("-------------------------") 
#drink
#Here you will need to multiply the #drink cost by you drink amount #before 
adding it to total_cost
print ("Drink") 
print (     "1 = Cola: 0.90, "     "2 = Lemonande: 0.80, "     "3 = Fizzy 
Orange: 0.90 " ) 
drink_costs = [0.9,0.8,0.9]

drink = input ("Enter a number for your choice of drinks " ) while drink>3 or 
drink<0:     drink = input ("Choices start from 0 to 3 " )drink = int(drink)
if drink == 1:     print "You have chosen Cola. The cost for this is 0.90" elif 
drink == 2:     print ("You have chosen Lemonande. The cost for this is 0.80") 
elif drink == 3:     print ("You have chosen Fizzy Orange. The cost for this is 
0.90") 
drink_cost = drink_costs[drink-1] drink_amount = input ("Enter the amount of 
drinks")drink_amount =int(drink_amount)while drink_amount >10 or 
drink_amount<0:     drink_amount = input (" You can only have upto 10 drinks, 
Please try again") drink_amount = int(drink_amount)
drink_cost *= drink_amounttotal_cost += drink_cost
print ("--------------------------------") print ("Calculating bill") print 
("--------------------------------") print ("--------------------------------") 
    print ("Thank You for ordering at Pizza Shed! ")
print("£", total_cost, sep = "")
Hey...I tried running this code, but it doesnt work ..

 Show original messageReply Reply to All Forward MoreNevina Dias 
<diasnev...@yahoo.co.uk>ToAlex KleiderMar 31 at 1:09 PMimport random import 
time 
print ("Welcome to Pizza Shed!")
total_cost = 0
tablenum = input ("Enter table number from 1-25 \n ")tablenum = 
int(tablenum)while tablenum>25 or tablenum <=0:     tablenum = input ("Enter 
the correct table number, there are only 25 tables ")     #Pizza menu with 
prices 
print ("---------------------") 
print ("Let me help you with your order!") 
print ("---------------------") 
print ("Menu") 
print (     "1 = cheese and tomato: 3.50, "     "2 = ham and pineapple: 4.20, " 
    "3 = vegetarian: 5.20, "     "4 = meat feast: 5.80, "     "5 = seafood: 
5.60 " )
pizza_costs = [3.5,4.2,5.2,5.8,5.6]
pizza_choice = input("Enter the type of pizza that you want to order from 1-5 
\n") pizza_choice = int(pizza_choice)while pizza_choice>5 or pizza_choice <=1:  
   pizza_choice = input ("Enter the right number ") 
if pizza_choice == 1:     print "You have chosen cheese and tomato. The cost 
for this is 3.50" elif pizza_choice == 2:     print ("You have chosen ham and 
pineapple. The cost for this is 4.20") elif pizza_choice == 3:     print ("You 
have chosen vegetarian. The cost for this is 5.20") elif pizza_choice == 4:     
print ("You have chosen meat feast. The cost for this is 5.80") elif 
pizza_choice == 5:     print ("You have chosen sea food. The cost for this is 
5.60")
#find the cost and then add it to the #totalcost = pizza_costs[pizza_choice - 
1]total_cost += cost    print ("------------------") 
pizza_amount = input ("Enter the amount of Pizzas that you want to order ") 
while pizza_amount > 10 or pizza_amount <=0:     pizza_amount = input ("Maximum 
amount is 10, Please enter again ") 
print ("--------------------") 
#base 
print ("Base") 
print (     "1 = thin and crispy,"     "2 = traditional" ) 
base = input ("Select a base from 1-2 \n") while base>2 or base<=1:     base = 
input ("There are only 2 types, Please enter again ") 
if base == 1:     print "You have chosen thin and crispy" elif base == 2:     
print ("You have chosen traditional")     print ("-------------------") 
#extra toppings 
print ("Extra Toppings") 
toppings = input ("Enter a number for your choice of extra topping \n Enter 1 
for extra cheese \n Enter 2 for extra pepperoni \n Enter 3 for extra pineapple 
\n Enter 4 for extra peppers \n" ) while toppings >4 or toppings < 0:     
toppings = input ("There are only 4 types of extra toppings, Please try again " 
) 
if toppings == 1:     print ("You have chosen extra cheese. The cost for this 
is 0.50") elif toppings == 2:     print ("You have chosen pepperoni. The cost 
for this is 0.50") elif toppings == 3:     print ("You have chosen pineapple. 
The cost for this is 0.50") elif toppings == 4:     print ("You have chosen 
peppers. The cost for this is 0.50") 
print ("-------------------------") 
#drink
#Here you will need to multiply the #drink cost by you drink amount #before 
adding it to total_cost
print ("Drink") 
print (     "1 = Cola: 0.90, "     "2 = Lemonande: 0.80, "     "3 = Fizzy 
Orange: 0.90 " ) 
drink_costs = [0.9,0.8,0.9]

drink = input ("Enter a number for your choice of drinks " ) while drink>3 or 
drink<0:     drink = input ("Choices start from 0 to 3 " )drink = int(drink)
if drink == 1:     print "You have chosen Cola. The cost for this is 0.90" elif 
drink == 2:     print ("You have chosen Lemonande. The cost for this is 0.80") 
elif drink == 3:     print ("You have chosen Fizzy Orange. The cost for this is 
0.90") 
drink_cost = drink_costs[drink-1] drink_amount = input ("Enter the amount of 
drinks")drink_amount =int(drink_amount)while drink_amount >10 or 
drink_amount<0:     drink_amount = input (" You can only have upto 10 drinks, 
Please try again") drink_amount = int(drink_amount)
drink_cost *= drink_amounttotal_cost += drink_cost
print ("--------------------------------") print ("Calculating bill") print 
("--------------------------------") print ("--------------------------------") 
    print ("Thank You for ordering at Pizza Shed! ")
print("£", total_cost, sep = "")
The code wont run and I was wonder whether, if the code is right in working out 
the total cost?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to