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.
Any difference with looping through
smileys
first then check membership inarr
?You are right, my solution is shorter. I solved it without lambda :D
This comment is hidden because it contains spoiler information about the solution
Clever, yes, but why is this a best practice?
It avoids unnecessary computation in the event of an empty input.
I receive an error as a result of the 9th basic test, one that doesn't make sense to me:
'hsi etTi satshsi etTi sats!' should equal 'This is a test!'
The length of these strings aren't equal, so I am confused about the solution to use now. Did anyone else get this error?
Don't worry. Thanks for taking the time to answer my question! :)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
No problem :)
Wow, thanks for this very clear explanation!
Mutating an array in a function is usually a bad practise because it modifies it permanently and you cannot revert the process. Mutating an array is good as long as it is a method of a class, for example: python has .sort() which is a method of the list class.
The Kata author has done:
What happens is that your solution ("invert" function) will modify the original array, and this modified array will be the parameter for the user's solution ("answer" function); therefore changing out the real expected solution.
I'm not sure if the Kata author did this accidently or purposely, but this "issue" is fine to be left because it stops people modifing the original array (deterring them to stop modifying the parameter). When making a Kata, I would usually do the same, however, I would inform the user not to mutate it in any way.
It can be "fixed" by:
Thanks, that worked! Do I need to do this in any kata, or was it just a glitch within this one? I'm eager to know why this happened.
Don't modify the original array.
Don't modify the original array.
Loading more items...