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.
wow
1K IQ play
I need this one explained to me lol Cause im not getting that at all
I need this one explained to me lol Cause im not getting that at all
Both list comprehension and RE is O(n) in this case.
genius
A reasonable optimizing compiler will produce the same machine code regardless of whether the variable is defined before the if-check or after it. Initializing local variables has no effects visible to callers so the compiler may freely reorder the code as it sees fit.
The reason is just style and clarity. First of all, it's common to add preconditions to the start of a function. If there are no items, we already know the answer and we can return right away. Second, it's generally a good idea to keep the scope of variables as small as possible.
Of course, in such a short function it doesn't really matter, but if a long function defines variable in the very beginning and uses it a lot later, can you be sure that there are no uses between? You have to carefully read through the whole function to check if there are other references.
This comment is hidden because it contains spoiler information about the solution
i cant tell you how many times i thought about Re but ended up not using it haha beautiful
Lmao. I'm so stupid.
Nice!
You do not need to get to this level.
PEP 8 has a recommondation for only 79 characters per line.
Do not feel bad if you need multiple lines.
The multi liner with a propper For, add to list, return new list is not a bad solution either. Not even in terms of speed.
anytime you want? i mean, idk what exactly the code means/does but i solved it the same way lol
Its something like retrun ( output, loop ) if you wanna return multiple stuff, and python just knows your x without you having to introduce her to it
The more time I spend on this website, the more amaze I am of all these one liner that exist T-T
completely forget about list expressions man
Loading more items...