Skip to content

Latest commit

 

History

History
37 lines (20 loc) · 703 Bytes

Pizza_Comparison.md

File metadata and controls

37 lines (20 loc) · 703 Bytes

CodeWars Python Solutions


Pizza Comparison

Definition

You and your friends are about to order pizzas. The pizzeria has two pizzas in their menu. The first one has diameter d1 and price price1 and the second diameter d2 and price price2. Return the diameter of the pizza which has the most value for money.

If the value for money of the two pizzas are equal return the second diameter.


Given Code

def which_pizza(d1,price1,d2,price2):
    pass

Solution

def which_pizza(d1,price1,d2,price2):
    return d1 if (d1**2/price1) > (d2**2/price2) else d2

See on CodeWars.com