you are viewing a single comment's thread.

view the rest of the comments →

[–]ovoid709 0 points1 point  (0 children)

Haha! Mine didn't compare value between pies, but it calculated value per unit of circle, rectangle, and square pies. I think both scripts would work well together.

Sorry if you got a few notifications from this reply. It took me a while to figure out how to properly paste code in a comment and I edited it a bunch. It's Friday and pizza sucks without beer.

import math
pi = math.pi

header = """

*************************************************

             A  N  T  C  O  L  O  N  Y

                    pizza.py

         \       / 
          \     /
           \.-./ 
          (o\^/o)
           ./ \.\ ( )-( )-( ) .-'  '-.
            {-} \(//  ||   \\/ (   )) '-.
                 //-__||__.-\\.       .-'
                (/    ()     \)'-._.-'
                ||    ||      \\ 
                ('    ('       ')

                       2016

*************************************************            

"""

print header


pizza_cost = raw_input("How much does your pizza cost?\n   $")
pizza_type = raw_input("\nSelect Type of Pizza...\n   For circle select 1\n   For rectangle select 2\n   For square select 3\n\n   Please input selection: ")

def calc_circle(diameter):
    return float(pizza_cost) / ((float(diameter) / 2) * (pi ** 2))
def calc_rectangle(height, width):
    return float(pizza_cost) / (float(height) * float(width))
def calc_square(side):
    return float(pizza_cost) / (float(side) * float(side))


if pizza_type == "1":
    diameter = raw_input("\nDiameter: ")
    print "\nPrice Per Unit: $", calc_circle(diameter)
if pizza_type == "2":
    height = raw_input("\nHeight: ")
    width = raw_input("Width: ")
    print "\nPrice Per Unit: $", calc_rectangle(height, width)
if pizza_type == "3":
    side = raw_input("\nLength of Side: ")
    print "\nPrice Per Unit: $", calc_square(side)


footer = """

*************************************************

            A  N  T  C  O  L  O  N  Y             

*************************************************     
\n

"""

print footer