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.
Spoiler flag; noted, and thank you for the clarifiction
Please, use spoiler flag next time. A string is a truthy value, so the one that doesn't work is always read as
True
This comment is hidden because it contains spoiler information about the solution
Good job
I think whoever wrote that was intending to pass a copy of the list, instead of allowing manipulation on the list itself. I'm not sure it was really necessary here, though.
For what I know the first argument is divided by the rest of the argument seperately.
hmm in the test case...
what's the point of
*args[:]
?Isn't that the same as
*args
?Have you tested it? It would definitely be faster in a compiled language but in scripting languages built-ins are usually preferable.
This comment is hidden because it contains spoiler information about the solution
You have a typo in your alphabet.
It is a good practice to import constants to avoid bugs like this with typos. Consider using
from string import ascii_lowercase
.This comment is hidden because it contains spoiler information about the solution
Yes. The single pass will perform faster. You won't notice this with the small tests in this kata, but let's assume that the list is actually a file on your hard drive, and it's 2 GBs big. If you read every value once, you only have to read 2GBs only once, too. With a second pass, you would have to read the complete file a second time.
If you have a sequence that's generated by a generator, you would have to keep the whole sequence in memory (which might not be possible), or generate it a second time (which might take too much time).
So even though their asymptotic complexity is the same (O(n) = O(2n)), their real performance varies tremendously (and we haven't even looked at caching effects).
HTH.
What's the difference of using Single pass vs. Two passes?
Does one computes faster than the other?