def prob3(a,b): """Calculate and return the length of the hypotenuse of a right triangle. Do not use any methods other than those that are imported from your 'calculator' module. Parameters: a (float): the length one of the sides of the triangle. b (float): the length the other nonhypotenuse side of the triangle. Returns: The length of the triangle's hypotenuse. """ return calc.sqrt(calc.add(calc.multiply(a,a), calc.multiply(b,b)))
def test_sqrt_of_zero_is_zero(): assert calculator.sqrt(0) == 0
def test_square_root_with_negative_gives_none(): assert calculator.sqrt(-5) == None
def test_square_root_with_positive(): assert calculator.sqrt(81) == 9
def test_sqrt_exercise_4(): assert sqrt(25) == 5
def test_sqrt_exercise_6(x, x2): assert sqrt(x) == x2
def problem2_3(a,b): return c.sqrt(c.add(c.mult(a,a),c.mult(b,b)))
def test_sqrt(): results = sqrt(9) assert results == 3 results = sqrt(16) assert results == 4
def test_sqrt(self): assert 4 == calculator.sqrt(16)