Python3 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/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))
Running the example above produces:
hypot(3, 2) : 3.605551275463989
hypot(-3, 3) : 4.242640687119285
hypot(0, 2) : 2.0
Python3 Numbers