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.
We're not told to do that. We're told to do this kata using the language we want, and we chose python. When someone gives you tools, you use it. We're using the tools that python gave us.
More than 2000 warriors used this solution. Hence, python has a lot of functions, but I believe others have a sorting function as well. Reverse, I don't really know, but it can be easily implemented using recursion. Then, ofc for instance java among other languages just convert a string to an integer, so it is not hackery. Your comment has many downvotes, as it is another advantage python users have.
Welcome to Python? It's kind of what we do.
In any case, you can pretty easily expand this to code in another language if you just implement the sorting, make a loop to put it into a string, and then turn it into an integer. None of those concepts are exclusive to Python, we just have built-ins so we don't have to waste our time writing mergesort eight-thousand times.
And in any case the point was to write out the code in Python, so I don't see your point.
Thanks I understood the problem.
The solution is not language agnostic. This is kind of hack with builtin functions. I would rather solve problem using algorithms than hacking with builtins.
It's a problem with your code, the first value of the error message is what your function is returning, not the input value. And it's because what I told you in the other post. If you want to know what the input is, print it, it'll appear above the test result.
See the right value is at the end of what your function is returning.
111151211098765432101097654296332119741 should equal 741
How these test cases are correct?
11115121109876543210 should equal 0
1111512110987654321010 should equal 10
1111512110987654321010976542 should equal 976542
11115121109876543210109765429633211 should equal 9633211
111151211098765432101097654296332119 should equal 9
111151211098765432101097654296332119741 should equal 741
For problems with your code use
Question
label instead. Not a kata issue.Don't use global vars, they keep their values between tests, is
BST._num
reset at some point?This comment is hidden because it contains spoiler information about the solution