What is math.hypot() in Python?

The math.hypot() function is used to calculate the Euclidean normDistance from the origin to given coordinates of input coordinate values.

Norm 2 Formula: Calculate distance from origin.

Syntax

math.hypot(x1, x2, ..., xn)

Parameters

x1, x2, ..., xn: Two or more points representing coordinates.

Return value

This function will return a primitive float value with a Euclidean norm, i.e., sqrt(x2x^{2} + y2y^{2})

Example

math.hypot() takes multiple points as an argument.

# Load math Library
import math
#print the Euclidean norm
print(math.hypot(10, 16))
print(math.hypot(6, 9, 11))
print(math.hypot(9, 3, 6, 13))
print(math.hypot(10, 5, 3, 11, 23))

Free Resources