Home >>Python math Module >Python math.sqrt() Method

Python math.sqrt() Method

Python math.sqrt() Method

Python math.sqrt() method in python is used to returns square root of a given number and it accepts a positive number (integer or float).

Syntax:
math.sqrt(x)

Parameter Values

Parameter Description
x It is required a number to find the square root
Here is an Example of Python math.sqrt() Method:

import math
print (math.sqrt(6))
print (math.sqrt(14))
print (math.sqrt(20))

Output:
2.449489742783178
3.7416573867739413
4.47213595499958
Example 2:

import math 
a = 5
b = 234
c = 14.45
d = 37
e = 0
print("square root of ", a, " is = ", math.sqrt(a))
print("square root of ", b, " is = ", math.sqrt(b))
print("square root of ", c, " is = ", math.sqrt(c))
print("square root of ", d, " is = ", math.sqrt(d))
print("square root of ", e, " is = ", math.sqrt(e))

Output:
square root of 5 is = 2.23606797749979
square root of 234 is = 15.297058540778355
square root of 14.45 is = 3.8013155617496426
square root of 37 is = 6.082762530298219
square root of 0 is = 0.0