Pizza price calculation | 计算披萨价钱🍕

Many of us are still in coronavirus lockdown. We are very proud of all of you for staying healthy and safe.😀

In today’s google classroom, we ordered some pizza for lunch. 🍕  We made a Python program to calculate 👩‍💻 which pizza size gives us the best value.

Our goal: to find the lowest price per bite.  To get that, we divide cost by size.

def pizzaBitePrice(radius,price):
    area=radius**2*3.14
    unit_price = price/area
    return(unit_price)
# small pizza
pizzaBitePrice(7,12)
0.07799298063174313
# medium pizza
pizzaBitePrice(8,14.75)
0.06593351910828026
# large pizza
pizzaBitePrice(9,14.75)
0.057993237398757565

👍The conclusion is: the large size one gives us the best value with price of 5.7 cents (plus tax) per bite.

error: Content is protected !!