Easy Tutorial
❮ Python Func Str Python String Decode ❯

Python3 hypot() Function

Python3 Numbers


Description

The hypot() function returns the Euclidean norm sqrt(xx + yy).


Syntax

Here is the syntax for the hypot() method:

import math

math.hypot(x, y)

Note: hypot() cannot be accessed directly. It is necessary to import the math module and then call this method through the math static object.


Parameters


Return Value

Returns the Euclidean norm sqrt(xx + yy).


Example

The following example demonstrates the use of the hypot() method:

#!/usr/bin/python3
import math

print("hypot(3, 2) : ", math.hypot(3, 2))
print("hypot(-3, 3) : ", math.hypot(-3, 3))
print("hypot(0, 2) : ", math.hypot(0, 2))

The output of the above example is:

hypot(3, 2) :  3.605551275463989
hypot(-3, 3) :  4.242640687119285
hypot(0, 2) :  2.0

Python3 Numbers

❮ Python Func Str Python String Decode ❯