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.
Writing everything in one line is a bad practice. It's just bragging about its tricky hardcore solution. It's too bad that many people called this solution "best practice" and "clever". This is a bad practice. And the solution is not smart, but abstruse and overcomplicated.
The solution from fortlasagna is much better. He generally does the same thing. But his code is much better structured and much better readable. Here he really shows the best practice.
I missed the "All spaces in the string should be retained" part!
Other than that I got it! Wohoo!
This is a great solution for double and single spaces! But for anything more you'll need to utilize RegEx
If you split for example "a__b" (double space instead of underscores) into a list, it will result in ["a", "", "b"].
When you join it later, there will be one space between "a" and the empty string "" - and another space between the empty string and "b". Therefore you end up keeping the double space like in the original string.
This comment is hidden because it contains spoiler information about the solution
A constraint that the strings wouldn't contain triple-spaces or even larger, was not stated so this solution also works well for those cases (I just tested) - well done.
I managed to solve after like an hour by adding space as a seperator but I don't know why it actually works this way
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is the first question after 50+ challenges where I got the exact same solution as the top one.I would always get like the 3rd,4th best practice.
Just keep doing these and look at other people's solutions and try figure out their thought process.
How did you account for the double spaced in your code?
You have nicely settled more spaces problem :|
i don't get why mine doesn't work, it seems like it's identical to your code, please tell me what's the difference between them and what's wrong with my code >_<
This comment is hidden because it contains spoiler information about the solution
Lol me neither... I went for importing re
Loading more items...