0
How do we square root in python
I canât seem to square root with the sqrt function in the SoloLearn idle What should I do? I tried import math I tried sqrt() I tried loads of things
3 Answers
+ 2
Aside from using sqrt() function from math module, you can use exponent operation (**). And use 1/2 or 0.5 as the exponent.
81 ** (1/2)
>> 9.0
You can also perform a cube root by using 1/3.
81 ** (1/3)
>> 3.0
+ 1
the code below works for me.
import math
x=math.sqrt(9)
print(x)
# ouput 3
0
from math import sqrt
print(sqrt(81))