How to find the hypotenuse of a right triangle in python ?


To find the hypotenuse of a right triangle in python, a solution is to use the modulemath, example:

>>> import math
>>> x = 2
>>> y = 3
>>> math.hypot(x,y)
3.605551275463989

Check:

>>> z2 = x**2+y**2
>>> math.sqrt(z2)
3.605551275463989

Références

Links Site
hypot() python doc