Question: PYTHON You must define the functions indicated in question (1) and use those functions appropriately in the main program. Do not use any global variables

PYTHON

You must define the functions indicated in question (1) and use those functions appropriately in the main program. Do not use any global variables in the functions. Not following those specifications will result in earning 0 points for the specification item of the rubric.

(1) Write the definition of functions with the following specification:

discArea(diameter): Returns the area of a disc with the given diameter

costPerSquareInch(diameter, price): Returns the cost per square inch of a pizza given the diameter of the pizza and its price. The cost per square is returned in cents and the price of the pizza is in dollars.

Note that the functions will be tested separately.

(2) Write a program that prompts for the diameter and price of one pizza and output the cost per square inch in cents rounded to two decimal places. Code for this program must be entered after the statement: if __name__ == "__main__":

If the input is

14 14.5 

the output begins with

Enter diameter of pizza: Enter price of pizza: Cost per square inch is 9.42 cents. 

(3) Extend the program to prompt for the diameter and price of a second pizza.

If the input is

14 14.5 12 12.5 

the output begins with

 Enter diameter of pizza: Enter price of pizza: Cost per square inch is 9.42 cents. Enter diameter of second pizza: Enter price of second pizza: Cost per square inch is 11.05 cents. 

(4) Extend the program so that it prints which of the two pizzas is a better deal.

Important: The cost per square inch must be rounded to two decimals.

If the input is

14 14.5 12 12.5 

the output ends with

 The 14-inch pizza is a better deal. 

If the input is

14 14.5 12 12.5 

the output ends with

 Prices of the two pizzas are equivalent. 

----------------------------------------------------------------------------------------------------------------------------

import math

# define discArea

# Define costPerSquareInch

# Main program if __name__ == "__main__":

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!