fonction hypot python3 ()
description
hypot () Renvoie la sqrt norme euclidienne (x * x + y * y).
grammaire
Ce qui suit est la syntaxe de méthode hypot ():
import math math.hypot(x, y)
Note: hypot () ne sont pas directement accessibles, vous devez importer le module de mathématiques, puis appeler la méthode par mathématiques objets statiques.
Paramètres
- x - une valeur.
- y - une valeur.
Valeur de retour
Retour norme euclidienne sqrt (x * x + y * y).
Exemples
Le tableau suivant montre un exemple d'utilisation du procédé hypot ():
#!/usr/bin/python3 import math print ("hypot(3, 2) : ", math.hypot(3, 2)) print ("hypot(-3, 3) : ", math.hypot(-3, 3)) print ("hypot(0, 2) : ", math.hypot(0, 2))
Après avoir exécuté l'exemple ci-dessus est sortie:
hypot(3, 2) : 3.605551275463989 hypot(-3, 3) : 4.242640687119285 hypot(0, 2) : 2.0