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.
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.
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
.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.