Articles

Program to find the square root of a number in Python

Program to find the square root of a number in Python


In this python program guide, we will learn to write a 

  • python program to find the square root of a number

Program to find the square root of a number in Python

The program to find the square root of a number in python is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

import math

number = int(input("Enter the number: "))

ans = math.sqrt(number)

print("The sq. root is:",ans)

The output of the python program to find the square root of a number is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter the number: 9
The sq. root is: 3.0

Few important point about this program:

1. To find the sqaure root of a number here, we are using the math library.

2. The .sqrt() method helps us to find the sqaure root of a number in python.

 

python program to find the square root of a number

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :    Published Date : Jan 28,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!