Question: Python code please. 6.44 LAB: Pizza Price Calculator (Variation) Write a function calc_pizza_price() that computes the total price to charge for a pizza Cp based

 Python code please. 6.44 LAB: Pizza Price Calculator (Variation) Write a

function calc_pizza_price() that computes the total price to charge for a pizza

Python code please.

6.44 LAB: Pizza Price Calculator (Variation) Write a function calc_pizza_price() that computes the total price to charge for a pizza Cp based on its diameter d and toppings. The formula you should use is Ntoppings C = 4 (P+ Pi i=1 where d is the diameter in inches, P is the base per-unit-area value of a plain cheese pizza with a default value of $0.10 in 2, and p; denotes the price per square inch of topping "i". Your calc_pizza_price() function should be able to handle any number of "topping prices per square inch" as keyword arguments. Each keyword will be intepreted as a topping name and its value the price per square inch for that topping. Implement calc_pizza_price() so that is returns a list. The first element of the list is the price of the pizza as a floating-point value, and the remaining elments are the names of the toppings, one at a time. If no toppings are requests, then the second element of the list should be the string literal 'plain'. 1 if 3 4 5 6 7 8 _name__ ' __main__': D=16 cheap_P0.09 result=calc_pizza_price(D, P=cheap_P, pepperoni=0.01, peppers=0.002, pineapple=0.007) total=result[0] toppings=result[1:] print('Price of {}-inch-diameter pizza (${:.2f} per sq. in.), {}: ${:.2f}'.format(0, cheap_P,', '.join(toppings), total)

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!