# Square Root with Python

In this article, I will take you through a Python Program to Find the Square Root of a number. But before getting started to find the square root of a number with the Python Programming Language let’s first understand what square root is.

The square root of a number is a value which, multiplied by itself, gives the number. Example: 4 × 4 = 16, so the square root of 16 is 4. One thing to note here is that (−4) × (−4) = 16 too, so −4 is also a square root of 16.

## Python Program To Find Square Root

I hope now you know what is a square root of a number. Now let’s see how we can find the square root of a number by using the Python Programming Language.

For the task of finding a square root by using a programming language, we need two variables. One variable for storing the value of that number we want to find the square root. The next variable we need is to store the square root of the number.

If you want to take a user input to store a variable to find the square root of a number, then it is prefered to take the user input as a float. Let’s see how to find the square root using Python:

```.wp-block-code {
border: 0;
}

.wp-block-code > span {
display: block;
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}
```num = 8

# Or to take the input from the user
#num = float(input('Enter a number: '))

num_sqrt = num ** 0.5
print('The square root of %0.3f is %0.3f'%(num ,num_sqrt))```Code language: PHP (php)```
`The square root of 8.000 is 2.828`

So this is how we can easily find the square root of any number by using the Python Programming Language.

I hope you liked this article on the Python Program to find the Square Root of a number. Feel free to ask your valuable questions in the comments section below. 