## DEV Community is a community of 851,084 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Scott Gordon

Posted on

# Pizza Cost Per Inch Calculator

``````# pizza_cpi_calc.py
#   This program calculates the cost per square inch of a circular pizza,
#   given its diameter and price. The formula for area is A = Pi X radius^2.
# by: Scott Gordon

import math

# Create a function to calculate the area of a pizza.
return area

# Create a function to calculate the cost per square inch of a pizza.
def cost_psi_pizza(price, diameter):
cost_psi = price / pizza_area
return cost_psi

# Run both functions to demonstate their output
def main():
# Get user input for pizza diameter and price.
pizza_diameter = int(
input("What is the diameter of your pizza in inches? "))
pizza_price = float(input("How much did the pizza cost? "))
print(

main()
``````

Photo by Ivan Torres on Unsplash

## Discussion (2)

Matt Curcio

For me the question becomes is there a correlation between price per in^2 and quality or taste? lol

shikkaba

Ah, but the price is already given to the pizza, and if you see the list of ingredients and an image of it, then your question may be answered?

Oh. My. God. I need to make a review website now. Since not all larges are the same size, you'll see how much you're paying per, and see the ingredients, and a picture, and see reviews... Gaaaaaaah someone's going to do this first now.