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
thank you
This comment is hidden because it contains spoiler information about the solution
Cool
This comment is hidden because it contains spoiler information about the solution
This shouldn't have worked, '\s' matches any whitespace character rather than just ' '
Love this one
nvm, chat-gpt said this:
a, *b = ...: This is the iterable unpacking syntax. It assigns the first value of the iterable to variable a and the rest of the values to a list variable b. The * (star or asterisk) is the extended unpacking operator introduced in Python 3.
What the start before the 'b' does?
Wouldn't it be better to run while there is an instance of double spaces rather than hard code a limit?
It's great to see someone not using regex
Why did you hard coded the replace block to run 10 times?
That's a smart one
So that's how you get rid of the if-else (cool)
Interesting question! Let's test:
JS Benchmark for several floor function alternatives
Results:
Math.floor
is about the same speed as other numeric methods for flooring a number, and all are far faster than you'll ever have to worry about.Conclusion: Use Math.floor for readability, but these kinds of micro-optimisations really do not matter lol.
Loading more items...