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.
( JS, probably others )
Returning inconsistent datatypes is not a best practice. There's a reason native
map
throws instead of returning a value; that's the correct behaviour by design.Lots of other problems with the kata design, but most have been raised already. This mess should probably just be retired; it's not worth the maintenance effort.
I saw another user had previously reported this issue, and though it was marked resolved, it has not been resolved. For input "0,1,2,3", the expected return value is "incorrect input" even though the input fits the criteria specified in the description (four consecutive numbers separated by commas). If this is considered incorrect input because it includes a zero (which is my best guess), then the description should be updated to use either "positive integers" or "natural numbers" in place of the word "numbers". If this is not the case, then the test case itself should be corrected.
Regardless of the reason the test case fails, the word "numbers" is too inclusive a term to be used in the description. If zero is considered valid input, then the term "whole numbers" should be used instead.
Edit: This is for the JavaScript version. I'm not sure if other versions have this issue as well.
Description does not mention whether negative numbers will be tested
Also inconsistency regarding this part in all languages (No tests in JS, but some in Python, Ruby)
This comment is hidden because it contains spoiler information about the solution
Ruby 3.0 should be enabled.
Ruby 3.0 should be enabled.
Somehow got the following complaint from the random tests (Ruby):
"0-8,-7,-6,-5"
It should work for random inputs too - Expected: "not consecutive", instead got: "incorrect input"
Random tests expect checking for array to include only numbers, and then verifying that second argument is a function. At the same time one of the fixed test expect you to verify that
func
is a function, and then check whether array includes only numbers.Expected result for
map(["31", "92", "5"])
is[False, True, False]
.The random tests in Python generate values like
0-7
.Also, when this happens the reference cannot convert such value to
int
, and the error message gives away the solution.Basically what anter69 said, but also with an additional test case for sequential numbers that don't all have the same number of digits (to break string sort solutions).
I think something is wrong with the Python tests. I pass all the default tests but fail the random ones:
Testing for [7, 4]
It should work for random inputs too: [False, True] should equal 'array should contain only numbers'
I'm quite sure both 7 and 4 are numbers.
Type coercion in JavaScript is nastry. Strongly recommend that '66' should fail the test but 66 works. Apparently strings are not numbers.