Here I am giving the 5 examples to get square root in Python.

## Example 1: Get Square Root in Python Using math Library

In the following example, it will import the library `math`

using the `from`

keyword and print the square root on the screen.

from math import print(sqrt(16))

### Output:

4.0

## Example 2: Get Square Root by Taking Input from The User

In the below example, it will ask the user to input any number and then will give the square root of that number:

import math a = int(input("what do you wnat to square root ")) print(math.sqrt(a))

### Output:

what do you wnat to square root 16 4.0

## Example 3: A Lengthy Program to Get Square Root in Python

import math toSquare = 300 squared = math.sqrt(toSquare) print(squared)

### Output:

7.0710678118654755

## Example 4: Using ** Operator

x = 16 y = x ** 0.5 print(y)

### Output:

4.0

#### See also:

Python – Multiple Constructors in a Class Example