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
This is why you should prevent eval from running on your server.
See my other solution for how to solve it properly.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It has been some time since I solved this one to be honest.
It's not like that the first idea is usually a one liner.
You just write the code in python or pseudocode to solve the problem and you start simplifying until you get to the essence of the solution and how it works.
Then you can write a one liner.
I get this feeling when my solutions are pretty complicated and I see one liners and I feel like "Whaaaat? It was much simpler that I thought".
I would too! Most of my solutions are compact on purpose just for fun.I am not trying to write production level code here. Just having fun and experimenting.
Cheers
Oh I see they are different cases.
However should str.split() produce error?
I mean according to this:
https://docs.python.org/2/library/stdtypes.html#str.split
"If sep is not specified or is None, a different splitting algorithm is applied: runs of consecutive whitespace are regarded as a single separator, and the result will contain no empty strings at the start or end if the string has leading or trailing whitespace. Consequently, splitting an empty string or a string consisting of just whitespace with a None separator returns []"
Split won't produce an error in any way.
Cheers.
Hello. I am talking about the empty delimeter case specifically.
I have added a dummy yield in my code to test the outputs of the tests.
Here is what I get:
What if there is no delimiter?
['asdasd'] should equal ['abc', 'def', 'ghi', 'jklmno', 'prrrr']
So I "fix" the code and I print my list and I get this error:
Expected an error when empty delimiter!
Why should it expect an error when there is no delimeter. Normal split() works without delimeter.
Cheers
Hello. I have misunderstood something.
All tests pass except the empty delimeter one.
I get this when I "return" the "right" list.
If I return something else the error is smth like.
"Should be ['abc', 'defg', 'blabla']" etc.
So where am I wrong?
Thanks
Well thanks.
Indeed it's a bit unreadable but I like reduce. I couldn't resist.
Cheers!
I have encountered a problem during the submit tests.
When the input is [], I get an IndexError on a function setZeroesSol, which is not the function that we are supposed to implement.
Cheers.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Nice kata to teach people how to do a bfs.
Only thing is that you need to add more testcases.
Yes -.-
Well I would never write code like this in production.
But thats what codewars is for right?
I like all that elegant stuff but that's all there is to it.
Cheers.
Loading more items...