# tpm.py Computes the cost per square inch of pizza given cost of the pizza,
# and diameter.
from math import *
def main():
cost_per_square _inch(area_of_p izza())
def area_of_pizza() :
diameter = input("Enter the diameter of the pizza: ")
radius = 1.0/2.0 * diameter
a = pi * radius * radius
return a
def cost_per_square _inch(area):
cost_of_pizza = input("Enter the cost of the pizza: ")
cost = cost_of_pizza/area
print "The cost per square inch of pizza is $%0.2f"%(cost)
return
main()
# and diameter.
from math import *
def main():
cost_per_square _inch(area_of_p izza())
def area_of_pizza() :
diameter = input("Enter the diameter of the pizza: ")
radius = 1.0/2.0 * diameter
a = pi * radius * radius
return a
def cost_per_square _inch(area):
cost_of_pizza = input("Enter the cost of the pizza: ")
cost = cost_of_pizza/area
print "The cost per square inch of pizza is $%0.2f"%(cost)
return
main()
Comment