Python Program to find the Square Roots

Python Program to find Square Roots

In this program, you’ll learn how to find Square Roots and Display it using Python function.

To properly understand this example to find square roots in Python, you should have the knowledge of following Python programming topics:

  • Python Operators
  • Python I/O and Import

Program to calculate the square root

#you can change 8 to any number
num = 8 

# uncomment 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))


The square root of 8.000 is 2.828

Python Program to find the Square Root

Here in the above Program, we’re storing the number in num and to find the square root we’re using the **exponent operator.

Note: This program works only for all +ve real numbers. But for -ve or complex numbers.

Related Program:

Ask your questions and clarify your/others doubts on Program to find square roots in Python by commenting. Python Documentation