Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Duplicate issue.
It does.
@freeman42x Integer division rounds down, which is needed anyway in the end. Intermediate roundings only slightly slow convergence. The main point is that every next approximation is closer than the previous and that in eventually stops.
@g964 Nvm, apparently it works fine regardless of using integer or floating point. Although I can't find good explanation on that.
@g964 using integer division is wrong, you should specify clearly in the description that the division should be floating point (or whatever non-integer division is called).
I see a mix of integer and non-integer solutions yet only the non-integer division ones should be valid.
All pass because the test cases are wrong.
I don't want to argue once more but I think one should take
(x + n / x) / 2
as a purely mathematical description and not as operations specific to a given language. If you look at the solutions (in Python or other languages) you will see that everyone has adapted this formula in his own way to get the result (Perl motto: There's more than one way to do it!). Nevertheless thanks for your posts!Modified with "repeatedly calculating a new approximate integer value
x
using:(x + n / x) / 2
" though the given examples show that at each step the new value is an integer.Also, in JS
/
always means floating point division.You can clarify it effortlessly by adding a tiny sentence in the descriptions while helping people doing the kata in other languages. Why not do it?
The description is written for a lot of languages, not specifically for Python...
I had the same kind of troubles on my IDE because of numpy. Try your algo without the module.
(EDIT: numpy is not used in the tests.)
Done.
Thanks for the suggestion.
Yes,
0
.This comment is hidden because it contains spoiler information about the solution
Done.