Can the square root be calculated using a method other than the exponentiation operator?


#1

Question

In this exercise, the square root of a number is calculated using the exponentiation operator. Is there another method available to do that?

Answer

The Python math library includes many useful functions including a sqrt() function. The following code sample shows an example of its usage.

from math import sqrt
print(sqrt(16))