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.
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 print("Enter 'x' for exit."); num = input("Enter a number: "); if num == 'x': exit(); 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:
This is the sample output asking from user to enter a number to find its square root:
Now enter a number say 25. As the square root of 25 is 5, then here is the output you will see:
Below is the same program on python shell:
Program Video with Compile and Run