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.
While I haven't submitted in JS, and I don't know if this is the case, what it looks like is that you are modifying the array in place, rather than making a copy. So the test cases create an array, then run your code on it. Then, in order to check your answer, they run their own doubling code on the same array. If you modified the array at all, then the answer won't be correct.
As you've noted, your code is indeed much longer than necessary. You might have noticed as you were typing your code that you have a lot of repeated code. Infact, the code for each different key is exactly the same! While you can still check the input is valid if you so wish, in the main body of the code you could replace your current repeated code with one piece of code, that just refers to
key
rather thanlegend
;)In future you might note that if you're given a variable as input, and told that it takes its value from a certain set, it's probably NOT a good idea to hardcode those values into your code.
Heavily inspired by this solution to the previous kata:
https://www.codewars.com/kata/reviews/592d2edafd1539bb080009c6/groups/592d8da47ef5d8306d00008d
Yeah I'm well aware your solution and a load of others pass the test cases, just a comment that given that it doesn't technically do what the kata asks for, it can't really be considered to be a really clever answer. You're probably right about the test cases, I haven't been involved in authoring kata or the like, so haven't really paid much attention to that.
Python description is rather vague. Please at least tell us what our function name should be, or provide Test Cases.
This kata made no sense. The solution (in Python) was very simple, but I just had to guess what the kata was asking for as the description/instructions were essentially irrelevent.
What happens if there are 102 dogs?
In python for the test cases the two arguments of assert_equals are back to front. Ie I was getting the message " '1000' should equal '0b10' " when the message should clearly be the other way round.
In Python the description does not match the kata. The description states that we should create a function combineNames, but the testcases require a function combine_names instead.
This comment is hidden because it contains spoiler information about the solution
You're entirely right. It was admittedly poor practise on my behalf that was causing my issue :L
Still an issue though, just a different one to what I thought. Either the description should state not to mutate the original list, or the message when a test fails should be clearer (or both).
It's not exactly a problem, but in python the variable inputArray probably ought to be called input_array instead ;)
Nice kata :)
Took me an embarrassingly long amount of time.
Loading more items...