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))
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))
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)
Example 4: Using ** Operator
x = 16 y = x ** 0.5 print(y)