Ad
  • Custom User Avatar
  • Custom User Avatar

    yonax, you uncovered a nasty bug. I have fixed it and added the test cases discussed above to the kata.

  • Custom User Avatar

    This was due to an issue in my logic for solving the problem. It has been corrected, and the kata has been republished.

    To confirm,

    vector_affinity([None], []) == 0.0 => True
    
  • Default User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    easy enough, but then shouldn't i also add:

    test.assert_equals(vector_affinity([None], [None, None, None, None]), .25)
    test.assert_equals(vector_affinity([None], [None, None, None, None, None]), .5)
    test.assert_equals(vector_affinity([None], [None, None, None, None, None, None, None, None, None, None]), .10)
    

    ?

    To me knowing that:

    vector_affinity([None], [None]) == 1.0
    # and
    vector_affinity([None], []) == 0.0
    

    should be enough to deduce that None is also a value that counts, and that [None]/[None, None] gets a .5 affinity.
    again, it's easy enough to add the test case, but unless that test case addresses a specific flaw in the instructions or problem, i'm hesitant to do so.