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.
The reason I do codewars is to see other people's answers after I complete a challenge as it helps me learn. Clearly have a lot to learn!
Me too, I'm very confused. Did you figure it out?
Yes, you need to reuse the input conserving its format.
In the test, sometimes the expected isbn is in this format 000-0-00000-000-0 and sometimes it is in this format: 000-0-00-000000-0 and sometimes in this format: 000-000-00-0000-0
all of my isbns are returned in the first format so I'm failing th tests. HOw do I know which format to use for which ISBNs?
Oh I think I answered the question, because the dashes need to be in the same place as they are in the original? I was confused because I thought that ISBNs are always in the format of the first example in the tests above. I will have another go.
The description gives an exact algorithm to calculate the output from the input, what's the problem, concretely?
why are the test output ISBNs in different formats - with dashes at different places? It doesn't mention this in the output instructions.
Ok, I figured it out on the other one. It's because I was trying to add 1 to an index that didn't exist. So I guess in the above I am trying to do something similar. I will work it out...
Thanks for this, if I put a return in place of the puts, I get this error message: ./lib/solution.rb:8:in
sum_of_differences': undefined method
-' for nil:NilClass (NoMethodError)Any ideas? It is working in vs code.
Actually I am getting the same error on a different kata. On this one it is because I am doing +1 on an array index, like I am in the code above. I think this is the problem. Do you know how to do this differently? Ta
You need to return the answer, not print it.
This comment is hidden because it contains spoiler information about the solution
congrats, you're welcome, happy coding
Eventually I have passed! Thanks for your help :)
Right, got it. Thanks!
consider this feedback using
console.log(
n = ${n});
at the beginning of your code:725635
10
1
Thanks, I see what you mean about the while part. Sorry I don't understand what you mean about 10 and 11 being outputs not inputs. This is what I input into the function call.
Can you give me any clues about how to approach this?
Loading more items...