What is math.sqrt() in Python?
The sqrt() function in Pythonreturns the square root of a non-negative number.
Figure 1 shows the mathematical representation of the sqrt() function.
The
mathmodule is required to use this function.
Syntax
sqrt(number)
Parameter
sqrt() requires a non-negative number as a parameter.
Return value
sqrt() returns the square root of the number sent as a parameter.
Example
import math#perfect square rootprint "sqrt(4):", math.sqrt(4)print "sqrt(0):", math.sqrt(0)#simple numberprint "sqrt(5):", math.sqrt(5)print "sqrt(4.5):", math.sqrt(4.5)