Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python math.sqrt() function is used to return the square root of the given non-negative number.

Syntax

math.sqrt(x)

Parameters

x Required. Specify a number.

Return Value

Returns the square root of the specified number.

Example:

In the below example, sqrt() function is used to find out the square root of the given number.

import math

print(math.sqrt(25))
print(math.sqrt(30))
print(math.sqrt(35.5))
print(math.sqrt(-25))

The output of the above code will be:

5.0
5.477225575051661
5.958187643906492
ValueError: math domain error

❮ Python Math Module