The math.hypot() method is used to return Euclidean norm.
Syntax
math.hypot(a1,a2,...an)
Parameters
This method can also handle more than two arguments in Python 3.8 and later
a1, a2,…an(required): The coordinates of the point.
Return Value
It returns a float value, which is the calculated Euclidean norm.
If passing value is not the number, it returns TypeError.
Visual Representation
Example 1: How to Use Math.hypot() Method
import math
#Calculate the Euclidean distance from the origin to the point
print(math.hypot(7, 5))
print(math.hypot(-7, -5))
print(math.hypot(7, 7))
Output
8.602325267042627
8.602325267042627
9.899494936611665
Example 2: Passing more than two points
import math
print(math.hypot(1, 3, 9))
print(math.hypot(5, 2, -6))
print(math.hypot(-4, -8, -12))
Output
9.539392014169458
8.06225774829855
14.966629547095764
That’s it.