Python hypot() function
Description
hypot() Returns the Euclidean norm sqrt(xx + yy).
Syntax
The syntax of the hypot() method is as follows:
import math
math.hypot(x, y)
**Note:** hypot() cannot be accessed directly; you need to import the math module and call the method through the static math object.
Parameters
- x -- a numeric value.
- y -- a numeric value.
Return Value
Returns the Euclidean norm sqrt(xx + yy).
Example
The following shows examples of using the hypot() method:
#!/usr/bin/python
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)
Running the example above produces:
hypot(3, 2) : 3.60555127546
hypot(-3, 3) : 4.24264068712
hypot(0, 2) : 2.0
Python Numbers