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.
This comment is hidden because it contains spoiler information about the solution
I'm assuming (due to lack of indentation) that you have
print(to_weird_case(string))
outside of the function in order to call it. If so, the NameError you encouter is due to you callingto_weird_case()
with the parameterstring
but this variable doesn't exist so you get an error.You don't have to include this since the testcases call the function automatically.
Codewars comments support markdown and html so you are able to section your code which includes indentation using 3 backticks. Use this so that I don't have to manually indentate your code.
You want it escape route (for it to stop running) to be length of the current recursion equal to 1 since otherwise it will return an empty string("1"[1:] will return an empty string). Change it to
len(str) == 1
.Sorry was going to reply to your comment later since I'm tired.