+ 2
Challenge : Square Rooting Natural Numbers
This question got me thinking for a while and I've got a solution myself but I wanted to see how the Masters of SoloLearn will deal with this. So the challenge is simple : If you try to calculate square root of some number like 12 which does not come out of the root like 4 does.( sqrt(4)=2, but sqrt(12)=3.46410161514 ). The challenge is to write a code that for example when the input is 12, it will return "2√3". I think it is a bit tricky but let's see what you can do ;)
6 Respuestas
+ 2
©Mehmet done :)
+ 1
Here it goes: https://code.sololearn.com/c30PuaoEL2l5/#py
+ 1
@Baptiste E. Prunier, nice code very short but I think you can improve it. When the input is a squared number like 4,25,36, it could write 2,5,6 not only sqrt(25).
+ 1
@Raul Uriarte Very nice one, similar to what I wrote the other day. Separating inside and outside is really smart :) You may use the root symbol "√" to make the output prettier :D