Home >>Python math Module >Python math.hypot() Method

Python math.hypot() Method

Python math.hypot() Method

Python math.hypot() method in python is used to returns the Euclidean norm, sqrt(x*x, y*y). Euclidean norm – is the length of the vector from the origin to point (x,y) , where x and y are perpendicular and base.

Syntax:
math.hypot(x1, x2, x3, ..., xn)

Parameter Values

Parameter Description
x1, x2, x3, ..., xn It is required to represent coordinates between the two numbers and more
Here is an Example of Python math.hypot() Method:

import math  
parendicular = 2
base = 15
print (math.hypot(parendicular, base))

Output:
15.132745950421556
Example 2:

import math 
x = 6
y = 2
print(math.hypot(x,y))
x = 6.8
y = 4.14
print(math.hypot(x,y))
x = 5
y = 1
print(math.hypot(x,y))
x = 6
y = -1
print(math.hypot(x,y))
x = -9
y = 2
print(math.hypot(x,y))
x = -4
y = -6
print(math.hypot(x,y))

Output:
6.324555320336759
7.961130572977685
5.0990195135927845
6.082762530298219
9.219544457292887
7.211102550927978