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.
did the same, so neat!
nice
perfect solution
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
didnt even know you could do that
Everyday you learn something new, nice.
Yes, Unnamed, you're entirely correct and this definitely should come under 'clever' rather than 'best practice'.
Additionally
+
constructs a new list, which is rather inefficient. I don't know about*
though. Have a look at my solution, iterators are made for such things.It doesn't really matter since for a solution written just for looks anything goes while for an optimal solution creating a list of (possibly 10000) Nones just to traverse it once and destroy is strange anyway.
You're correct. I used just
[None]*len(keys)
for the sake of brevity, but ideally you'd use[None]*(len(keys) - len(values))
in practice.I found this solution good, but when we multiply [None]*len(keys) it will produce redundant "len(keys) - len(values)" objects in values list. What if keys length = 10000 and values length = 2?