# math.hypot() method with example in Python

Python math.hypot() method: Here, we are going to learn about the math.hypot() method with example in Python.
Submitted by IncludeHelp, on April 18, 2019

## Python math.hypot() method

math.hypot() method is a library method of math module, it used to find the result of Euclidean norm, sqrt(x*x, y*y), it accepts two numbers and returns the result of Euclidean norm.

Euclidean norm – is the length of the vector from the origin to point (x,y).

Note: If we provide anything like string, except a number, it returns a “ValueError” – “TypeError: a float is required”.

Reference: Python math library

Syntax of math.hypot() method:

```    math.hypot(x, y)
```

Parameter(s): x, y – numbers to calculate Euclidean norm.

Return value: float – it returns a float value that is the calculated result of Euclidean norm.

Example:

```    Input:
x = 2
y = 3

# function call
print(math.hypot(x,y))

Output:
3.605551275463989
```

### Python code to demonstrate example of math.hypot() method

```# python code to demonstrate example of
# math.hypot() method

# importing math module
import math

# numbers
x = 2
y = 3
print(math.hypot(x,y))

x = 2.3
y = 3.34
print(math.hypot(x,y))

x = 0
y = 3
print(math.hypot(x,y))

x = 2
y = 0
print(math.hypot(x,y))

x = -2
y = 3
print(math.hypot(x,y))

x = -2
y = -3
print(math.hypot(x,y))
```

Output

```3.605551275463989
4.055317496818221
3.0
2.0
3.605551275463989
3.605551275463989
```

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates