How do you square root a number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do you square root a number?

9th May 2018, 7:27 PM
Osamudiamen Nwoko
Osamudiamen Nwoko - avatar
6 Answers
+ 2
Jan Markus Ok sorry, I didn't see that. What advantages does your method have over sqrt()?
10th May 2018, 3:49 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
Jan Markus That's true, it is shorter, but isn't taking the square root of a negative number illegal?
10th May 2018, 4:47 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
0
what do you mean by variant
9th May 2018, 7:42 PM
Osamudiamen Nwoko
Osamudiamen Nwoko - avatar
0
The first option is simpler.
9th May 2018, 7:43 PM
amchancy
amchancy - avatar
0
ok thanks
9th May 2018, 7:44 PM
Osamudiamen Nwoko
Osamudiamen Nwoko - avatar
0
import math and use the sqrt() function.
9th May 2018, 11:52 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar