+ 2
Why this code didnt work ?
I dont know , that uses an base algorithm for radications and I don't know why the code always output 0 . Link of the code : http://www.sololearn.com/app/sololearn/playground/caiqF2klALun
2 ответов
+ 1
The reason is the "int" method: for a number it returns the next lowest integer. So int(12.4)=12 and int(19.98)=19.
And you are doing exponent = 1 / a and for a >1 the variable exponent will be slightly greater than 0, but below 1, so int(exponent) will every time return 0 (given that a in my example is greater than 1) and every multiplication will result in 0 if at least one of its factors is 0. So for all numbers b*0=0.
+ 1
Thanks my friend