At the beginning i thought it's a cool trick,
but after i knew that, it's a built-in method.
So it's technically same as the for loop i wrote, but it was written long time ago :)
knowing the built-in methods is my goal right now. Thanks
You can assume that in Python, there is always a clever built-in method to do basic stuff. That goes for counting, sorting, spliting, parsing, etc...
Trying to solve it youself iteratively is a good practice but try to find that time saving built-in method.
For example an other handy list method is .sort(), check it out and pay attention to its "key" parameter ;)
nice solution.
lol
Nice, I also have the same solution :))
This comment is hidden because it contains spoiler information about the solution
Great solution, well done! This has gotten me to think differently about how I write my code
little correction for ==:
if solution == nice: print('nice')
I thought of the same :)
Yet another example of python's simplicity
At the beginning i thought it's a cool trick,
but after i knew that, it's a built-in method.
So it's technically same as the for loop i wrote, but it was written long time ago :)
knowing the built-in methods is my goal right now. Thanks
pretty
just look at other solutions using one additionnal line before the comprehension.
What's the O(n^2) solution ?
I find it useful to keep on hand the methods Python provides to sequence types like lists or dictionaries.
I never knew this before. Guess i learned something new :D
You can assume that in Python, there is always a clever built-in method to do basic stuff. That goes for counting, sorting, spliting, parsing, etc...
Trying to solve it youself iteratively is a good practice but try to find that time saving built-in method.
For example an other handy list method is .sort(), check it out and pay attention to its "key" parameter ;)
Loading more items...