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

20th Jun 2021, 11:49 PM
Tommy Cho
Tommy Cho - avatar
3 odpowiedzi
+ 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
21st Jun 2021, 4:20 AM
noteve
noteve - avatar
+ 1
the code below works for me. import math x=math.sqrt(9) print(x) # ouput 3
20th Jun 2021, 11:56 PM
you are smart. you are brave.
you are smart. you are brave. - avatar
0
from math import sqrt print(sqrt(81))
21st Jun 2021, 1:57 AM
TOLUENE
TOLUENE - avatar