Hello everyone, Welcome back! Here we discuss a very simple python program which finds the square root of a given number using a module called
Math and use one of its method
You can watch the video on YouTube here.
SquareRoot – Code Visualization
To find square root of a given number.
- Read input number for which the square root is to be calculated using
- Pass that number to
sqrtmethod will return the square root of the number passed.
- Print the result.
import math num = float(input('Enter a number: ')) print('The square root of %0.3f is %0.3f' % (num, math.sqrt(num)))