What Is the Sqrt Function in Python?


Quick Answer

The sqrt function in Python returns the square root of a given number. The syntax for the sqrt function is math.sqrt(x) where x equals any number greater than zero. For example, entering the sequence print "math.sqrt(100) : ", math.sqrt(100) returns a result of math.sqrt(100) : 10.0.

Continue Reading
Related Videos

Full Answer

The sqrt function is not directly accessible in Python. To use the sqrt function, first import the math module, then call the sqrt function using math static object. To calculate the square root of a complex number, the sqrt function must be used with the cmath module rather than with the regular math module.

Learn more about Computer Programming

Related Questions