Ad
  • Custom User Avatar

    5h lucky guy :D. My brain is mashed for month... it looks like I wont be coder so soon :(

  • Custom User Avatar

    You should return the answer, and not print it. If you tried returning it and it still did not work, you probably have some other problem. Maybe this paragraph, or the overall article, will be helpful.

  • Custom User Avatar

    Hi team,
    again me struggling with easy task.
    Finally I did what the kata expected from me. Also the output looks exactly same.
    But from some reason, it is givin only failed results.

    here is the output:
    Mine:
    Log
    '20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11'
    Expected:
    None should equal '20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11'

    I tried to close the function with return, without return, simple print it.
    But I still missing something.

    Can you give me any hint please ?

    Many thanks

  • Custom User Avatar

    None means that your function did not return anything. If your function would have, for example, returned the number 3 the output would be: "3 should equal [2]"
    You can return an empty list with:

    list = []
    return list
    
  • Custom User Avatar

    hm I am not sure what do you mean by input.
    In the Sample test window there are these tests:

    Test.describe("Basic Tests")
    Test.assert_equals(array_diff([1, 2], [1]), [2], "a was [1, 2], b was [1], expected [2]")
    Test.assert_equals(array_diff([1, 2, 2], [1]), [2,2], "a was [1, 2, 2], b was [1], expected [2,2]")
    Test.assert_equals(array_diff([1,2,2], [2]), [1], "a was [1,2,2], b was [2], expected [1]")
    Test.assert_equals(array_diff([1,2,2], []), [1,2,2], "a was [1,2,2], b was [], expected [1,2,2]")
    Test.assert_equals(array_diff([], [1,2]), [], "a was [], b was [1,2], expected []")

    So I guess that these are input for the function ?
    I also ran the function with arguments but getting same full fails.

    Otherwise this is output:

    Test Results:
    Log
    a was [1, 2], b was [1], expected [2]
    a was [1, 2, 2], b was [1], expected [2, 2]

    Basic Tests
    Log
    a was [1, 2], b was [1], expected [2]
    a was [1, 2], b was [1], expected [2]: None should equal [2]
    Log
    a was [1, 2, 2], b was [1], expected [2, 2]
    a was [1, 2, 2], b was [1], expected [2,2]: None should equal [2, 2]
    Log
    a was [1, 2, 2], b was [2], expected [1]
    a was [1,2,2], b was [2], expected [1]: None should equal [1]

    I dont understand what "None should equal ..." means,
    as it was not mentioned in the instruction.

  • Custom User Avatar

    Presumably you aren't testing the test that it fails for
    Suggestion: print the input

  • Custom User Avatar

    Hello all, I am struggling with this my first Kata and I dont know how to successfully run the test on it.
    In the PyCharm IDE the script works fine and gave me all the results (from test or extended attempt test).
    But it still gave me all failed. Is there some misunderstanding between the chair and keyboard ? What am I
    doing wrong ?

    Can anybody help me ?
    Many thanks.