Ad
  • Default User Avatar

    Thank you. It finally worked after I added an if statement to handle the situation when words is an empty string.

  • Default User Avatar

    But in that case, how is my code passing all the test cases?

  • Default User Avatar

    Still facing the same problem. This is what I'm getting:

    Time: 662ms Passed: 17 Failed: 0 Exit Code: 1

    Test Results:
    Basic Tests
    Test Passed
    Test Passed

    Random Tests
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed
    Test Passed

    STDERR
    Traceback (most recent call last):
    File "main.py", line 24, in
    randtest(30)
    File "main.py", line 17, in randtest
    test.assert_equals(to_nato("".join(strIn)), " ".join(strOut))
    File "/home/codewarrior/solution.py", line 9, in to_nato
    ind = ord(words[0]) - 65
    IndexError: string index out of range

  • Default User Avatar

    My code (Python) is passing all the test cases. But it also shows a stderr. So, I can't submit. What could be wrong?

  • Default User Avatar

    I'm having the same problem. Only one test case failed. I have no idea what I'm doing wrong.