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
instead you could use
please remember to use the spoiler tag when posting code (I have added the tag)
it actually takes less time if you use it once
Yes, but it's considered a bad practice (for example, if you do it with several modules, there can be name collisions). Better import just the methods you need, or import the module like you did here.
Oh that is nice, i did not know you could use the method directly with from X import *! Does this work for every import?
Not best practice, but fun for codewars.
the walrus operator
No, on that line,
a
andb
are not yet defined, so it barfs. Also: misses the point that constants are better than string concatenation.You can mix single and double quotes in a string. For example, instead of writing:
you can simply write:
and avoid using backslashes.
We are not in 1960 and this is Python. There is no significant difference in speed on modern CPUs for this trivial task.
Use spoiler flag next time, please.