0

How to calculate the hypotenuse of a right angle triangle given the length of two sides

calculation

10th Jun 2019, 10:35 AM
gain
4 Answers
+ 1
from math import sqrt def hypotenuse(x,y) return sqrt(x**2 + y**2) print hypotenuse(3,4) >>>output: 5.0
10th Jun 2019, 10:53 AM
Mo Hani
Mo Hani - avatar
10th Jun 2019, 10:54 AM
HNNX 🐿
HNNX 🐿 - avatar
+ 1
https://code.sololearn.com/cPUrWZPo78g5/?ref=app https://code.sololearn.com/cQHST4uk0c8o/?ref=app
10th Jun 2019, 10:55 AM
HNNX 🐿
HNNX 🐿 - avatar
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))
10th Jun 2019, 4:30 PM
Seb TheS
Seb TheS - avatar