0
How to calculate the hypotenuse of a right angle triangle given the length of two sides
calculation
4 Respuestas
+ 1
from math import sqrt
def hypotenuse(x,y)
return sqrt(x**2 + y**2)
print hypotenuse(3,4)
>>>output: 5.0
+ 1
https://code.sololearn.com/cPUrWZPo78g5/?ref=app
https://code.sololearn.com/cQHST4uk0c8o/?ref=app
0
from math import sqrt, cos, radians
def simple_pythagoras(a, b):
return sqrt(a * a + b * b)
def extended_pythagoras(a, b, alpha):
alpha_rad = radians(alpha)
return sqrt(a * a + b * b - 2 * a * b * cos(alpha_rad))