
Untitled
By: a guest on
Apr 30th, 2012 | syntax:
Python | size: 1.83 KB | hits: 23 | expires: Never
from __future__ import division #To stop 1//2 == 0 (From a friend)
#Name: Hy Diep
#Date: 4-27-12
#This script will help you determine the cost of your order at Dr. Joe's Pizzeria.
def main():
while True:
#Pricing Variables
Peporoni= 5.55
Mushroom= 10.00
Sasuage= 30.00
Pineapple= 40.00
Tax= .15
#Pricing for pizza types.
print ("Peporoni is 5.55")
print ("Mushroom is 10.00")
print ("Sasuage is 30.00")
print ("Pineapple is 40.00")
print ("Tax per person is 15%")
print
numberPizzas = input("How many whole pizzas? ")
numberPeople = input("Number of People? ")
typePizza = input("Type of Pizza? ")
typeDiscountPercent = input("If avaliable, what is the discount percentage? (Number only) ")
typeDiscountDecimal = typeDiscountPercent / 100
if typeDiscountPercent > 0:
Totaldiscount= str(((numberPizzas * typePizza) + (numberPeople * Tax)) * (1 - typeDiscountDecimal))
if typeDiscountPercent < 0:
Total= str((numberPizzas * typePizza) + (numberPeople * Tax))
if typeDiscountPercent > 100:
print "Error! Only numbers between 0 and 100!"
else:
if typeDiscountPercent > 0:
print "Total Cost is " + (Totaldiscount)
if typeDiscountPercent < -0:
print "Error! Only numbers between 0 and 100! Please try Again!"
else:
if typeDiscountPercent < 0:
print "Total Cost is " + (Total)
reset = raw_input("Do you need to restart? Yes or No ")
if reset is ("No"):
break
#I can't seem to break it for some reason.
main()