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
Hey I'm reducing maintenance costs by reducing lines of code! :D
This comment is hidden because it contains spoiler information about the solution
It's fun.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Because rabbit and turtle have the same number of letters.
In this case it's actually faster to create the temporary list than to use a generator. When performing a string join, Python always operates on a list, because it needs to iterate through the elements in the sequence multiple times. First to determine the total length of the final string and allocate memory, and second to copy each part into the final string. If
join
is passed an iterator, it then has to create a new list and copy everything from the iterator, invoking the iterator for each element, which is more effort than just creating the temporary list in the first place. For reference, see the implementation of PyUnicode_Join in the Python source code.The code will probably crash if there is no loop. However, the kata guarantees that there will be a loop.
This comment is hidden because it contains spoiler information about the solution
Thanks, I think I've eliminated the test cases where empty strings could be passed in.
I deleted those from the global scope. Is that sufficient? I'm not too familiar with the Node environment.
Maybe try using getDay() instead of getUTCDay(). I think creating a new Date object is based in your current timezone, so depending on your timezone, checking UTC might throw off your result.
The original kata required you to directly access the Scales object's attributes. tiriana updated the kata 2 years ago with the better API, but left the old attributes accessible for backwards compatibility. See the kata disccusion for details.
Technically, the kata doesn't define what the result should be for a single-digit ticket number.
However, I would posit that the result of
luck_check('1')
should betrue
because 1) it is a valid string representation of a decimal number and 2) the number of digits on either side of the1
is zero, and the sum of zero digits is defined by convention to be0
; therefore the sum of the digits on both sides is equivalent.That said, it really only matters what the kata sensei thinks; but we don't know this, since the situation is not in the tests.
Loading more items...