# Find square root in python

Written by

## Square root in Python Program

In this program, we will be designing a code to find the square root of a number given by the user in Python.

The function `sqrt`

is generated in order to find the square root of a number passing the number `n`

as an argument in the function.

**Note: The exponent operator `**`

is used to calculate the power of a number. It is written as `a ** b`

, where `a`

is the base and `b`

is the exponent.

**Algorithm:**

- Define a function
`sqrt`

that takes in a single argument`n`

. - Inside the function, calculate the square root of
`n`

using the equation`n ** 0.5`

and assign the result to the variable`x`

. - Prompt the user to enter a number and store the input in the variable
`n`

. - Call the
`sqrt`

function with the argument`n`

to calculate the square root of the user-specified number. - Print the result stored in the variable
`x`

. - Exit the program.

**Code:**

```
def sqrt(n):
x = n ** 0.5
print(x)
n = int(input("Enter the number whose square root you need to find: "))
sqrt(n)
```

**Output:**

```
Enter the number whose square root you need to find: 25
5.0
```