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.
Can just do len instead of ('').ne
Also, no list() wrapper is needed
great work!)
@weijin96
post code below and I'll have a look for you.@ankitom
You are receiving this error because you are casting an empty string to an integer. Your variablenum
doesn't get appended to and remains and empty string; therefore when you cast it to an integer, you receive an error.1.) If there is an empty string, you must return "1" (string) not 1 (integer). You fail for an empty string: "" -> 1 (expected "1").
2.) If there isn't an integer at the end of the string, you have to put "1" at the end of the string. Your code receives an error because
num
is not appended to and you get an error. You have to add a "1" at the end of the string, since there isn't a number.3.) Your code fails when
string="foobar00"
because your code doesn't check zeros, so num has been appended to and therefore it tries to cast an empty string.Im having the same problem and i still dont understand the issue even after using print() because i dont think im casting an empty string
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Facing same issue.
The parantheses are not neccesary
We need that because one of the kata test cases calls
howManyLightsabersDoYouOwn()
, i.e. no function arguments. If we supply a default for name, then we don't have to worry about that case.I do not recall, since it's been a while since I've posted this solution, but I think that I just used the method template provided by the kata and have not changed the signature of the method myself.
It could be, that the kata has changed slightly since then.
Hmm why do we need any empty string as a default value for name here? Shouldn't it work without that?