The math.sqrt() function returns the result of the square root operation on a numeric variable. It takes a positive number as an argument value to be passed into the function.
Note: Results are dependent on the compiler. There may be a small variation or results may not be as precise as expected.
sqrt() function is implemented with the following syntax:
num_var is a positive number.
The function returns the square root of
num_var = 25print(math.sqrt(num_var))
The code returns the following output:
The code below demonstrates the method with a negative value.
num_var = -25print(math.sqrt(num_var))
The results will look like this:
nan stands for “not a number”, which represent undefined or unpresentable numerical results.