Ad
  • Custom 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

    The code works when I run it in VS Code so that's why I was confused. I still don't understand how my code can pass all the tests and still produce an error.

  • Custom User Avatar

    So for this kata I wrote a solution that did not manipulate the original list. I passed all of the tests but when I go to attempt my soultion I passed all 4 tests and then get an STDERR: error that says this:

    Traceback (most recent call last):
    File "main.py", line 16, in
    Test.assert_equals(binary_array_to_number(array), n,"It should work for random inputs too")
    File "/home/codewarrior/solution.py", line 13, in binary_array_to_number
    num.append(digit * binary[ind])
    KeyError: 4

    Does anyone know how to fix this?
    P.S I did not use the reverse() as I see in other comments