Python square root sqrt() method

Python sqrt() method is used to get the square root of the given number. sqrt() method can return square of any number. This method comes under math module.

Basic Syntax

Following is the basic syntax for sqrt() method in Python:

sqrt(number)

And the parameters are:

ParameterDescription
numberThe number whose square root should be returned

Return Value

sqrt() method in Python will return the square root of the given number. If the value is less than 0 then it will return Runtime Error.

Examples

Following are the examples for sqrt() method in Python:

Example 1

The output should be:

The square root of 64 is 8.000

Example 2

The output should be:

The square root of 9:
3.0The square root of 9.9:
3.14642654451

The square root of 0:
0.0

The square root of 8:
2.82842712475

LEAVE A REPLY

Please enter your comment!
Please enter your name here