Ad
  • Custom User Avatar

    It'll run as long as you don't change the function name in the initial code.

  • Custom User Avatar

    This kata is 9 years old, quality reviewing in the beta was not strong at the time.

    I tried to be more mathematically exact in the description. Could you please check if it is more clear now or suggest some further improvements?

  • Custom User Avatar

    Updated to Python 3.11, but your solution is not sufficiently fast.

  • Custom User Avatar

    No. The output should be screen size, not the ratio. A 32x8 screen is not equivilent to a 4x1 screen.

  • Custom User Avatar

    That's a problem with your code, not with the tests. Delete that line.

  • Custom User Avatar

    Seems correct to me. ex "love", first letter "l" and last letter "e" dont change, "ov" sorted alphabetically is, well, "ov".

  • Custom User Avatar

    THE MORE YOU PROTEST, THE WORSE YOU LOOK

    You're the one keep protesting against test data that is intended to be [solution, input] but you misinterpret it as [input, solution].

    You need to observe the basic test code carefully:

    tests = [
        [["i", "to", "beg", "life"], ["beg", "life", "i", "to"]],
        [["", "pizza", "brains", "moderately"], ["", "moderately", "brains", "pizza"]],
        # ...
    ]
            
    for exp, inp in tests:
        test.assert_equals(sort_by_length(inp), exp)
    

    You can see that the first item of the list is intended to be the solution, not the input. The input is the second item. The test has handle this correctly, it puts the second item (the input) to function, and check whether it matches the solution (first item).

    Again, if you don't like the test order of [solution, input], fork the kata -> edit the fork -> submit.

  • Custom User Avatar

    It is not an error. People have different perspective of how the tests should be managed. It doesn't have to be in the order of [input, solution]. Although, yes that can make some people be confused of the test, the one that wrote the python translation wanted it [solution, input], so be it. The test still working fine right? It's a weird thing making it a reason to label it as an error.

    If you don't like it, you can just fork the kata, edit it, submit it, and wait for approval.

  • Custom User Avatar

    If you print out the array in your function, you may see for yourself what is being passed in, and if it is already sorted or not. You may also try returning a hardcoded answer for the first testcase and see what passes and what fails.

  • Custom User Avatar

    Uh... not really. The code goes: for exp, inp in tests: ... , meaning the first list is the expected result, and the second one is input. It's a bit strange, sure, but it still works.

  • Custom User Avatar

    Could you rephrase this? I don't understand what's the problem here.

  • Custom User Avatar

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

  • Custom User Avatar

    That means you are returning more than 2 lists.

  • Custom User Avatar

    Yes, it's a problem with your code. Sometimes you're adding a number greater than p there. Please mark your post as having spoiler content next time.

  • Custom User Avatar

    I tried your solution which passed without problem.

  • Loading more items...