codescracker


python

Python Program to Find Square Root of Number



« Previous Program Next Program »


Find Square Root of Number in Python

To find square root of any number in python, you have to ask from user to enter a number to find and print square root of that number as output as shown in the program given below.

Python Programming Code to Find Square Root of Number

Following python program ask from user to enter a number to find the square root of that number and then finally will print the square root as output:

# Python Program - Find Square Root of a Number
		
while True:
	print("Enter 'x' for exit.")
	num = input("Enter a number: ")
	if num == 'x':
		break
	else:
		number = float(num)
		number_sqrt = number ** 0.5
		print("Square Root of %0.2f is %0.2f" %(number, number_sqrt))

Here is the sample run of the above python program to illustrate how to find square root of a number:

python find square root of number

« Previous Program Next Program »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test