Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    plus 2177 more warriors

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Thanks I understood the problem.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    Python Completions 22821

    For problems with your code use Question label instead. Not a kata issue.

  • Custom User Avatar

    Don't use global vars, they keep their values between tests, is BST._num reset at some point?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution