How to Find the Square Root in Python?

14-Jun-2021

.

Admin

How to Find the Square Root in Python?

Hi guys,

Now let's see example of how to find the square root in python program. I would like to share with you get square root in python program. We will talk about how to get square root in python. In this artical I will show you how to find square root in Python.

Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

Here I will give you four example of get square root in python. So let's see the bellow example.

Example 1


# Store numbers

number = 5

# Square root numbers

sqrt = number ** 0.5

print("The Square Root is ", sqrt)

Output :

The Square Root is 25

Example 2

# Store input numbers

number = int(input("Enter Number: "))

# Square root numbers

sqrt = number ** 0.5

print("The Square Root is ", sqrt)

Output :

Enter Number: 2

The Square Root is 4

Example 3

import math

# Store input numbers

number = int(input("Enter Number: "))

# Square root numbers

sqrt = math.sqrt(number)

print("The Square Root is ", sqrt)

Output :

Enter Number: 6

The Square Root is 36

Example 4

import math

# Store input numbers

number = int(input("Enter Number: "))

# Square root numbers

sqrt = math.pow(number,0.5)

print("The Square Root is ", sqrt)

Output :

Enter Number: 4

The Square Root is 16

It will help you...

#Python