Question: #Python program that prompt for the diameter #and cost of pizz and then find the cost per square #inch ofpizza.If the cost per square inch
#Python program that prompt for the diameter #and cost of pizz and then find the cost per square #inch ofpizza.If the cost per square inch is the above 10 #print pizza is too expensive othewise its a good deal #pizza.py from math import pi; def main(): #prompt user to enter the diameter of pizza diameter = float(input("Enter the diameter of the pizza: ")) #prompt user to enter cost of the pizza cost = float(input("Enter the cost of the pizza:$ ")) #get area of the circular pizza area=get_area_of_pizza(diameter) #call costPerSInch method to get the cost per square inch of pizza costPerSquareInch=costPerSInch(cost,area) print("The cost per square inch of pizza is $ %.2f"%costPerSquareInch)
if costPerSquareInch>10: print('Pizza is too expensive') else: print('Its a good deal')
#Function that takes diameter and returns #area of the circular pizza def get_area_of_pizza(diameter): return pi * ((diameter * 0.5) ** 2)
#Function that takes price and area #and returns the cost per square inch def costPerSInch(price, area): return price / area
#calling main method main()
Write a graphics program to calculate the cost per square inch of a circular pizza and use graphics .py libaray. Accept as input the diameter (in inches) and pizza price. Print the cost per square inch. If the cost per square inch is more than $.10 print a message that informing the user that this pizza is too expensive. Otherwise let the user know this is a good deal! and name it pizza.py.....This is a PYTHON language
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
