in this program, we will be creating a Python Program to Find the Square Root of a number using the exponent operator and cmath module For positive numbers using exponent**

At first we have to create a variable name **num **inside that we have to give float data type and enter a random number. After that we will be using math formula **num**0.5 ** after using this formula we have to print the number.

## Python Program to Find the Square Root [Source Code]

Note: change this value for different results

```
num = float(input('Enter a number:'))
num_sqrt = num**0.5
print('The square root of %0.3f is %0.3f'%(num,num_sqrt))
```

**Output**

```
Enter a number:7
The square root of 7.000 is 2.646
```

we store the number in num and observe the square root utilizing the ** example administrator. This program works for all sure genuine numbers. However, for negative or complex numbers, it tends to be as follows.

```
num = eval (input('Enter a number:'))
num_sqrt = cmath.sqrt (num)
print('The square root of {0} is {1:0.3f}+{2:0.3f}'.format(num,num_sqrt.real,num_sqrt.imag))
```

**Output**

```
Enter a number:1+2j
The square root of (1+2j) is 1.272+0.786j
```

In this program, we use the sqrt() function in the cmath (complex math) module.

Notice that we have utilized eval() work rather than float() to change over complex numbers also. Additionally, notice the manner by which the result is organized.

In case of any doubt ask me on social media

**Also, Read**

- Python Program to Display the multiplication Table 13
- Python Program to choose a random word from the list
- Python Program to Check size of a file
- Amazing tool Auto Copy paste Clipboard Using Python

[…] Also read:- Python Program to Find the Square Root […]