# Python math.sqrt() Method

Python math.sqrt() method “returns the square root of any number.”

## Syntax

``math.sqrt(number)``

## Parameters

x: It is any number such that x>=0. The sqrt() function takes a number as an argument.

## Return Value

It returns the square root of a number argument.

## Example 1: How to Use math.sqrt() Method

Import math module to work with mathematical operations in Python.

``````import math

print(math.sqrt(81))`````` It is the best way to find the square root of any number.

## Example 2: Passing positive argument

Another way will give us the same output, but the number must be positive, not negative, and not complex.

``````num = 49

sq_root = num ** 0.5
print(sq_root)``````

Output ## Example 3: Passing a complex number

To calculate a square root of a complex number in Python, use the cmath module. To use the cmath module, you must import it and then use its sqrt() function.

``````import cmath

print(cmath.sqrt(1 + 2j))``````

Output That’s it.

This site uses Akismet to reduce spam. Learn how your comment data is processed.