Related Tags

python
communitycreator

# What is math.hypot() in Python?

Fouzia Bashir

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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($x^{2}$ + $y^{2}$)

### Example

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

# Load math Libraryimport math#print the Euclidean normprint(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))

RELATED TAGS

python
communitycreator

CONTRIBUTOR

Fouzia Bashir