Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If you print
repr(splited_words)
, you'd probably see the problem.I get the same error "Extra zeroes handling" when I submit without known what to do next, also I cann't get the 10-th test case to find out what's wrong with my code.
splited_words = morseCode.split(' ')
decoded_string = ''
for word in splited_words:
splited_characters = word.split(' ')
for ch in splited_characters:
decoded_string += MORSE_CODE[ch]
decoded_string += ' '
return decoded_string.strip()
Mm, no, I think it shouldn't, as the function unput consists of 1's and 0's, and it's extra 0's at the beginning and end of the input that must be cared of.
Shouldn't it be "extra spaces handling"?
Well, I see your problem. It's the CodeWars platform problem for now, that when the code throws unexpected exception (like probably
KeyError
in your case), it doesn't count as a test failure, while essentially it is."Your Test Cases" pre-set for you are only basic tests for you to use, modify and improve to fix and polish your solution. They're not exhaustive and passing them never means your solution is fully right. The real test set that verifies your solution for correctness is much more picky. For this kata, the submit test set consists of 12 tests. So if you see something like an exception stack and then "9 Passed 0 Failed 0 Errors" and the output is "red", it means 10-th test didn't complete and raised exception instead.
To find out what's wrong with your solution, make sure to read Instruction carefully and check what the failing tests say (if exception occured after "Extra zeroes handling", it probably means your solution can't properly handle extra zeroes, check Instructions for details). If that doesn't help, find out what was the input that caused your function to raise exception, and try identifying the problem by looking at that input.
Good luck! :)
And feel free to ask if something is still unclear. CodeWars is still in Beta, it has some issues and requires some persistense at the beginning, but then it's so much fun!