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
It's a couple of operation carried out one after another. You know, same as all other code?
This comment is hidden because it contains spoiler information about the solution
Thanks
This comment is hidden because it contains spoiler information about the solution
And now I've read something new ... the asterisk (splat or unpack operator) will iterate over an iterable and serve one element at a time. Using a double-asterisk will iterate over a key-value iterable and serve up one key-value pair at a time.
Point made earlier that this is clever but not necessarily the most readable.
Why this isn't already published?
I'm sorry if I sounded agro. But random tests are not optional => issue.
I think it already was stated on line one. Why so agro?
This comment is hidden because it contains spoiler information about the solution
Please mark it as an issue.
You need random test, a lot. But you already know it.
In this link you can see how to propperly make some tests in JavaScript. Random tests are, as the name says, random. Generate 500 random numbers to test with.
Quick note for people seeing this on the main page: this code is not related to this kata and is therefore not a spoiler. The code provides zero help to someone trying to solve the kata.
I see that the kata is retired, but I wanted to make good on my promise to provide the explanation for this issue.
Let's pretend we're making a kata that gives the user an array and asks them to return the array with each element incremented by 1. Here's our simplified test code:
The user could submit code like this and it would work, because it's a valid answer:
The print lines from the test code will show:
All good.
Except it isn't, because we are sending an array to the user's solution and then we use that same array in the kata's solution. This means the user could modify the array in their code and then the kata's solution would use that modified array.
This is only possible because arrays are passed by reference, unlike most other objects (integers, strings, etc), which are passed by value. See this article for a more comprehensive explanation.
For example, the user could write this:
That sets every item in the array to 0 and then returns an array of 1s.
The print lines from the test code will show:
This is problematic for several reasons:
There's two main ways to solve this problem:
Steffan153 has solved the problem using the second solution.
This type of issue can occur in lots of languages, such as Python, C#, JavaScript, etc. So it's always worth checking beta kata's in case they have this issue, because then it can be fed back and resolved before the kata is approved.
As I said in the description the program was made in order to help me and actually worked (was writting menus in different languages).
Thanks for the help, maybe next time.
except that in this case, the constraint is rather on 2 different columns that are left justified, each with it's own width. While here, you put a global constraint (mx) which wasn't making sense considering the expected formatting.
Loading more items...