Python3 Función hypot()
Descripción
hypot()Retorna la norma euclidiana sqrt(x*x + y*y).
Sintaxis
La sintaxis del método hypot() es la siguiente:
import math math.hypot(x, y)
Nota:No se puede acceder directamente a hypot(); se necesita importar el módulo math, y luego invocar el método a través del objeto estático math.
Parámetros
- x -- Un valor numérico.
- y -- Un valor numérico.
Valor de retorno
Retorna la norma euclidiana sqrt(x*x + y*y).
Ejemplo
A continuación se muestra un ejemplo del uso del método 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))
El resultado de ejecutar el ejemplo anterior es:
hypot(3, 2) : 3.605551275463989 hypot(-3, 3) : 4.242640687119285 hypot(0, 2) : 2.0Otras extensiones
Números en Python3