Calculer une hypoténuse avec python

Published: 14 avril 2015

DMCA.com Protection Status

Pour calculer rapidement une hypoténuse avec python il existe la fonction hypot dans le module math, exemple:

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

Verification:

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

Recherches associées

Liens Site
hypot() python doc