Learn about Sqrt of a Number in Python using Math Function in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Sqrt of a Number in Python using Math Function
The sqrt() function in the math module is used to find the square root of a number.
# Python program to find square root of the number
# importing math module
import math
num = float(input('Enter the number: '))
# print result
print('Square root of a number = ',math.sqrt(num))
Output:
Enter the number: 25
Square root of a number = 5.0
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Find Square root of a Number Python