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.
I hadn't read that line about math.floor, because it is preceded by "Note for JavaScript, Coffescript, Typescript...." Didn't know that there is information needed for Python solution also.
The progression that @Pigankle posted uses floating-point numbers, and does not round down at each step. The problem statement doesn't ever explicitly say that it expects you to round your guesses to integer at each step, but the final line (suggesting the use of
Math.floor
"for each integer approximation") is trying to suggest that. However, the problem statement does need to be a bit clearer about saying "Your guesses should be integers at each step".I am seeing the same result as Arcuo. Hero's Method converges in 29 steps for the input parameters given in that test. I printed out each step and counted them. I double checked this with excel. If the five of us who are getting 29 were instead writing code that converged too slowly, I would think we are doing something wrong. As is, we are converging faster than others, and I cannot see how we could be incorrect.
I am very sorry but there are no errors in the test that are the same in many languages. Moreover, as you can see at the top of the page, 102 guys passed the Python kata. It is not because you don't find the same results as in the tests that there is an issue with the kata!-)
My python solution runs through all the tests, but the last one of the suite. The test says that the count should be 30, but mine does it in 29 iterations of calculating a new x. It's only in the last test is there a mistake in the last test?
Test.assert_equals(int_rac(835871232077058, 1), 30)??
When i tried a simple if statement work around, the test suddenly wants 29 :O
Absolute are not integers. Meaning: abs(-0.5) or abs(0.5) both equals to 0.5.