def getLeg(self, number): if self._leg[number - 1] == 0: if number == 1: self._leg[0] = float(math.sqrt(square(self._hypotenuse) - square(self._legs[1]))) if number == 2: self._leg[1] = float(math.sqrt(square(self._hypotenuse) - square(self._legs[0]))) num = number - 1 return self._legs[num]
def test_exponent(self): self.assertEquals(exponent.calc(5, 7), math.pow(5, 7)) self.assertEquals(exponent.calc(-5, 7), math.pow(-5, 7)) self.assertEquals(exponent.square(17), 17*17) self.assertEquals(exponent.cube(17), 17*17*17)
def test_exponent(self): self.assertEquals(exponent.calc(5, 7), math.pow(5, 7)) self.assertEquals(exponent.calc(-5, 7), math.pow(-5, 7)) self.assertEquals(exponent.square(17), 17 * 17) self.assertEquals(exponent.cube(17), 17 * 17 * 17)
def getHypotenuse(self): if self._hypotenuse == 0: self._hypotenuse = math.sqrt(square(float(self._legs[0])) + square(float(self._legs[1]))) return self._hypotenuse