# How to find Square root of a number in Python

We can find the square root of a number by using the math module. The ** sqrt()** function is an inbuilt function in

` math module `

that returns the square root of any number.Syntax: `math.sqrt(x)`

x is any number such that x>=0

# python program to # find square root # of a number import math print(math.sqrt(0)) print(math.sqrt(9)) print(math.sqrt(15))

Output:

0.0 3.0 3.872983346207417

When the passes value is less than 0:

>>> import math >>> math.sqrt(-1) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: math domain error

Subscribe

Login

Please login to comment

0 Discussion