What if instead our votes were just valued to scale with the level of a programer. I agree with you that my opinion means significantly less than someone with a higher kyu
I'm going to be very blunt because I'm growing very sick of comments like these. If this solution is bad practice or hardcore to you, then you shouldn't be doing Python. Plain and simple. There are many scenarios where one liners are bad, and this is not one of them. Under most style guides, this is the way to solve this problem. This is how it is done in production. Your solution has poor performance and looks like spaghetti - the gall to try and knock on the doors of better solutions talking about "not smart, but abstruse and overcomplicated." It is not the job of others to use simple language constructs to appease you. Look inwards and try to explore the language better.
Some people like to write one-liners as a challenge, not everyone is setting out to write perfectly readable enterprise-level code. It's not their fault other people upvote them. Let people have their fun without the lecture.
Not to mention, as far as python goes, this really isn't unreadable, it's pretty clear what this does.
no it works for all kinds of words. the reason it works is calling split(' ') on strings with double or arbitrarily spaced characters produced empty strings in the return value, and when you call .join() all the empty strings are joined back with spaces between them. the empty strings from splitting multi-spaced strings act as placeholders for when the string is re-formed so the spacing is preserved
Writing everything in one line is a bad practice. It's just bragging about its tricky hardcore solution. It's too bad that many people called this solution "best practice" and "clever". This is a bad practice. And the solution is not smart, but abstruse and overcomplicated.
The solution from fortlasagna is much better. He generally does the same thing. But his code is much better structured and much better readable. Here he really shows the best practice.
I love how you changed the paramter to 'bool' to match the function name
What if instead our votes were just valued to scale with the level of a programer. I agree with you that my opinion means significantly less than someone with a higher kyu
I'm going to be very blunt because I'm growing very sick of comments like these. If this solution is bad practice or hardcore to you, then you shouldn't be doing Python. Plain and simple. There are many scenarios where one liners are bad, and this is not one of them. Under most style guides, this is the way to solve this problem. This is how it is done in production. Your solution has poor performance and looks like spaghetti - the gall to try and knock on the doors of better solutions talking about "not smart, but abstruse and overcomplicated." It is not the job of others to use simple language constructs to appease you. Look inwards and try to explore the language better.
Some people like to write one-liners as a challenge, not everyone is setting out to write perfectly readable enterprise-level code. It's not their fault other people upvote them. Let people have their fun without the lecture.
Not to mention, as far as python goes, this really isn't unreadable, it's pretty clear what this does.
Buddy, what is the overcomplication of this solution? Everything is simple and clear
no it works for all kinds of words. the reason it works is calling split(' ') on strings with double or arbitrarily spaced characters produced empty strings in the return value, and when you call .join() all the empty strings are joined back with spaces between them. the empty strings from splitting multi-spaced strings act as placeholders for when the string is re-formed so the spacing is preserved
interesting
Writing everything in one line is a bad practice. It's just bragging about its tricky hardcore solution. It's too bad that many people called this solution "best practice" and "clever". This is a bad practice. And the solution is not smart, but abstruse and overcomplicated.
The solution from fortlasagna is much better. He generally does the same thing. But his code is much better structured and much better readable. Here he really shows the best practice.
it seems he is working for Google and have no time to answer
very cool my boy
whats the bottom line mean
I missed the "All spaces in the string should be retained" part!
Other than that I got it! Wohoo!
when you use if nums
python check if the list at least have one element and return true
if list is empty python return false so automatically the if block is not excuted
nice
yessir
Loading more items...