Ad
  • Custom User Avatar

    Reraised as issue with more detail

  • Custom User Avatar

    Fixed by last python update.

  • Custom User Avatar

    finally approved :)

  • Default User Avatar

    First line run, minimum of arr is 1, arr.index() returns the first index (searching from the left) of an occurrence of 1, which happens to be 0. m gets 0.

    Next, sorted() is called on arr and returns a new sorted array, [1,1,2,3,4]. On the other side, arr[m:] with m=0 becomes arr[0:] gives [1,2,3,4,1]. arr[:m] with m=0 becomes arr[:0] gives []. [1,2,3,4,1]+[] gives [1,2,3,4,1]. [1,1,2,3,4] == [1,2,3,4,1] evaluates to False.

  • Custom User Avatar
  • Custom User Avatar
  • Default User Avatar

    A bit late but i have now approved it!

  • Default User Avatar

    oh hell yeah, I'll join it, that sounds like a much better workflow

  • Default User Avatar

    Also, I forgot to add: there is a #help-author channel on the Codewars Discord when you can ask for help/advice, or get people to review your draft katas before publishing them; this can help you iron-out any early problems (and also determine if your idea is judged "interesting" enough before you spend hours working on it).

  • Default User Avatar

    You're welcome, glad it was useful;

    Note also that you can read the Test Cases of any kata you have solved - recently approved katas, or ones with high approval ratings can be a good source of inspiration if you want to get a feel for the Codewars test suite, and good practices (it's how I figured this stuff out myself).

    Best wishes for your kata authoring in future, I hope you stick with it!

  • Default User Avatar

    this is a HUGE help, obviously for this Kata but also to understand for future Katas. If I can get this process down I think I'll really enjoy writing them :)

  • Default User Avatar

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

  • Default User Avatar

    hello sir-- I wrote random tests but not sure about the syntax to execute-- would you help me please? It's my first Kata and I can't find the syntax in docs/Google...

    Many thanks in advance!

    The python code works fine, but the test execution syntax is throwing an error:

    File "/workspace/default/tests.py", line 45
        test.assert_equals(matt(test_list[0]), solution(test_list[0])
                                               ^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: invalid syntax.
    

    @test.describe('Random Tests')
    def rnd_tests():
        test_list = []
    
        lotsofcharacters = '1234567890!@#$%^&*()abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZmattMATTmattMATT'
    
        def generate_some_test_strings():
            # our new string
            new_string = ""
            # picks a random length for string
            length_of_string = randint(2, 10)
            # picks random characters according to the length of the string
            for i in range(0, length_of_string):
                new_string += lotsofcharacters[randint(0, 71)]
            test_list.append(new_string)
    
    
        # generate 10 random string to test against
        for i in range(10):
            generate_some_test_strings()
                
        test.assert_equals(matt(test_list[0]), solution(test_list[0])
        test.assert_equals(matt(test_list[1]), solution(test_list[1])
        test.assert_equals(matt(test_list[2]), solution(test_list[2])
        test.assert_equals(matt(test_list[3]), solution(test_list[3])
        test.assert_equals(matt(test_list[4]), solution(test_list[4])
        test.assert_equals(matt(test_list[5]), solution(test_list[5])
        test.assert_equals(matt(test_list[6]), solution(test_list[6])
        test.assert_equals(matt(test_list[7]), solution(test_list[7])
        test.assert_equals(matt(test_list[8]), solution(test_list[8])
        test.assert_equals(matt(test_list[9]), solution(test_list[9])
    
  • Default User Avatar

    thank you! I'll fix it up :)

  • Custom User Avatar

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

  • Loading more items...