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.
Almost the same solution as me. But I wonder why this doesn't get an error "list index out of range", when i+5 are > len(digits). Can someone explain please?
highly inefficient
cheater ;-)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Well since we are talking about words/sentences, they can be only so long, so I don't see why performance would play a huge part in this code. At least for the test cases both solutions are almost equal (sorted even being a bit faster).
True but you have to use floor division in that case, otherwise you will get an error for range doesn't work with floats
This comment is hidden because it contains spoiler information about the solution
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
This comment is hidden because it contains spoiler information about the solution
yes, it's called list comprehension. Without the brackets you will get an error.
It doesn't, but: "You may assume the parameter is non-negative."
what's wrong about this solution and which would be best practice in this case?
This comment is hidden because it contains spoiler information about the solution
Loading more items...