# Python Program to Find the Square Root

In this post, we will learn how to find the square root of a number using Python Programming language.

This program asks the user to enter a number, and then it computes the square root of the entered numbers using following ways:

1. Using Exponents
2. Using math.sqrt() Method
3. Using math.pow() Method

So, without further ado, let’s begin this tutorial.

Contents

## Python Program to Find the Square Root

```# Python Program to Find the Square Root
num = float(input("Enter a number: "))

# Finding square root
sqrt = num ** 0.5

# Displaying output
print("The square root of %.2f is %.2f." %(num, sqrt))
```

Output

``````Enter a number: 2
The square root of 2.00 is 1.41.
``````

## How Does This Program Work ?

```num = float(input("Enter a number: "))
```

The user is asked to enter a number. The value of the entered number gets stored in the num named variable.

```# Finding square root
sqrt = num ** 0.5
```

Now, we have used exponent sign (**) to compute the square root. We know that any number of the power ½ or 0.5 is the square root of that number.

So, we have used an exponent of power 0.5 to compute the square root. The square root of the entered number gets stored in the sqrt named variable.

```# Displaying output
print("The square root of %.2f is %.2f." %(num, sqrt))
```

Finally, the square root of the entered number is displayed on the screen using print() function.

## Python Program to Find The Square Root Using math.sqrt()

```# Python Program to Find the Square Root Using math.sqrt()
import math

num = float(input("Please enter a number: "))

# Finding Square Root
num_sqrt = math.sqrt(num)

# Displaying output
print("Square root of %.2f is %.2f." %(num, num_sqrt))
```

Output

``````Please enter a number: 8
Square root of 8.00 is 2.83.
``````

## Python Program to Find the Square Root Using math.pow()

```# Python Program to Find Square root Using math.pow()
import math

num = float(input("Enter a number: "))

# Find square root
sqrt = math.pow(num, 0.5)

# Displaying output
print("The square root of %.2f is %.2f." %(num, sqrt))
```

Output

``````Enter a number: 12
The square root of 12.00 is 3.46.
``````

## Conclusion

I hope after going through this post, you understand how to find the square root of a number using Python Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to assist you.