Answer to Question #284433 in Python for Dan

Question #284433

Malayan Yellow Hut’s Pizza parlor has specialized systems that can identify how many slices that can be taken from a pizza of a given size. This system uses the following facts:


·      Each slice should have an area of 14.125 inches.

·      To calculate the number of slices, simply divide the area of the pizza by 14.125

·      The area of the pizza is calculated using the formula area = πr2.

 

Improve their systems by allowing it to identify how many pizzas should be ordered given a number of people expected to eat and the diameter of the pizza. Assume that each person is expected to eat an average of 4 slices.


1
Expert's answer
2022-01-03T04:28:19-0500
import math

No_of_Persons = int(input("Enter No. of Persons: "))

AvgDiet = 4    # Avg. Diet per person
SliceArea = 14.125
print("Unit Slice Area = ",SliceArea)
print("Avg. Diet per person = ",AvgDiet)

RequiredPizzaArea = No_of_Persons*SliceArea*AvgDiet
print("Required Pizza Area = ",RequiredPizzaArea," sq. inch")
PI = 3.157
R = math.sqrt(RequiredPizzaArea/PI)       # Radius of Pizza
D = round(2*R,2)
print("Required Diameter of Pizza = ",D," inches")



Sample Output:

Enter No. of Persons: 3

Unit Slice Area = 14.125

Avg. Diet per person = 4

Required Pizza Area = 169.5 sq. inch

Required Diameter of Pizza = 14.65 inches

>>> 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS