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

  • I don't know how to use this one

  • Again, thanks for the feedback! This issue was quite hard to resolve. So I have tried to address all 'cheating' ways to solve this kata. Now 'cheating' is not completely impossible, but these ways are at least as difficult as solving this puzzle in intended way.

  • Thanks for your feedback! Issue fixed.

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

  • Instead I have restricted the usage of dis module

  • Unfortunately, I can't do this:
    I got Error when submitting any solution, because it requires importing((

    Traceback (most recent call last):
    File "main.py", line 2, in
    NameError: name 'import' is not defined

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

  • Thanks for your feedback :)

    1. x/ damn, I didn't even see the inversion of the parameters... :/
    2. /
    3. ah ok, my bad again (I didn't read the description again). So maybe just add meaningful feedback to the assertion?
  • Hi!

    1. It is done intentionally: to show that output of weird_mul(A, B) and weird_mul(B, A) is the same in first case (the calls of function are formally different)
    2. fixed
    3. In the description I have marked that if the shape of the input matrix is not 2d, function should return None, so I guess in this example (with not valid B) you have an output, which is a 2d matrix and the test to compare it to None fails. But in my opininon, it is a problem of the limitations of test framework, not working with 2d matrices. No idea how to fix this.
      This is the code I use here:

    test.assert_equals(weird_mul(A, C), None, 'Should return None in case of 1d input')

    Again, if the output is 2d numpy array assertion throws an error

  • Almost good! Still 2 3 problems, though:

    • you still have a double assertion in the sample tests.
    • use the Test.it decorator for the random tests instead of the Test.describe one
    • third test in "Edge cases" part:

    I encounter that error:

    Unexpected exception raised

    A = [[1 2]
         [3 4]]
    B = [6.94965891e-310 4.68139363e-310 6.94965966e-310 4.68133491e-310
         4.68139350e-310 4.79243676e-322 4.68139369e-310 4.68139354e-310
         6.94965871e-310 1.72922976e-322]
    my output:
    [[6.94965891e-310 1.38993178e-309]
     [4.68139363e-310 9.36278726e-310]
     [6.94965966e-310 1.38993193e-309]
     [4.68133491e-310 9.36266983e-310]
     [4.68139350e-310 9.36278701e-310]
     [4.79243676e-322 9.58487353e-322]
     [4.68139369e-310 9.36278738e-310]
     [4.68139354e-310 9.36278709e-310]
     [6.94965871e-310 1.38993174e-309]
     [1.72922976e-322 3.45845952e-322]
     [2.08489767e-309 2.77986356e-309]
     [1.40441809e-309 1.87255745e-309]
     [2.08489790e-309 2.77986387e-309]
     [1.40440047e-309 1.87253397e-309]
     [1.40441805e-309 1.87255740e-309]
     [1.43773103e-321 1.91697471e-321]
     [1.40441811e-309 1.87255748e-309]
     [1.40441806e-309 1.87255742e-309]
     [2.08489761e-309 2.77986348e-309]
     [5.18768928e-322 6.91691904e-322]]
     
     
     Traceback (most recent call last):
      File "/runner/frameworks/python/cw-2.py", line 83, in wrapper
        try: func()
      File "main.py", line 79, in edge_tests
        test.assert_equals(weird_mul(A, C), None, 'Should return None in case of 1d input')
      File "/runner/frameworks/python/cw-2.py", line 31, in assert_equals
        expect(actual == expected, message, allow_raise)
      File "/runner/frameworks/python/cw-2.py", line 15, in expect
        if passed:
    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
    

    Seems to me your B input is not valid ;)

  • I fixed both issues: there are no more double calls in random tests as well as there are no more mistakes there (caused by generating 0-shape matrices).

    Also I have changed the description and the solution: now if warrior tries to pass wrong- or 0-shaped matrices, function should return None.

  • Loading more items...