Calling a function from another function for calculation (Python)
Question: My problem is I'm trying to call the function cost from the other function
area to do all the value return from the main function call. This is a
homework and I'm stuck. The problem would be easy for me if I did not have to
call the cost function from the area function and just do my calculations.

    
    
    import math
    
    
    def cost(price, area):
    
        return price / area
    
    def area(size):
    
        radius = size / 2
        area = (radius**2) * math.pi
        finalprice = cost(price, area) / area
        return finalprice
    
    
    def main():
    
        size = int(input("How big is your pizza?: "))
        price = float(input("How much does the whole pizza cost?: "))
    
        answer = area(size)
        print("${0:0.3f}".format(answer))
    
    main()
    


Answer: why would you divide the area twice? I guess you trying to compute what each
unit square area costs for the pizza?

    
    
    import math
    def area(diameter , price):
        radius = diameter / 2
        area = (radius**2) * math.pi
        finalprice = price/ area
        return finalprice
    def main():
        size = int(input("How big is your pizza?: "))
        price = float(input("How much does the whole pizza cost?: "))
        answer = area(size, price)
        print("${0:0.3f}".format(answer))
    
    main()
    

