Python Math hypot() Method
Python Math hypot() returns Euclidean parametric sqrt(xx + yy).
Python Math hypot() Syntax
Here is the syntax of the hypot() method:
import math
math.hypot(x, y)
Note: hypot() is not directly accessible, you need to import the math module and then call the method via the math static object.
Python Math hypot() Parameters
- x : A value.
- y : A value.
Python Math hypot() Return Value
Returns the Euclidean norm sqrt(x*x + y*y).
Python Math hypot() Example#1
The following shows an example of using the hypot() method.
#!/usr/bin/python3
import math
print ("hypot(6, 4) : ", math.hypot(6, 4))
print ("hypot(-6, 6) : ", math.hypot(-6, 6))
print ("hypot(0, 2) : ", math.hypot(0, 2))
Output:
Python Math hypot() Example#2
Error in the hypot() function.
#!/usr/bin/python3
import math
print("hypot(3, 4, 6) : ", math.hypot(3, 4, 6))
Output: