15
koborC
1 11 28
1041/ 1195
sakura usagi
Last seen 2 months ago
Member for 3 years, 6 months, 11 days
Difficulty Normal
Best reviews / Newest reviews
lambda lambda-veky 2 1
I didn't know that the lambda expressions can use default values like ```c=lambda x:set(x.split(","))``` ! Thank you! xd More
filter end>begin-shenghanteng 2
for those who come to this solution later. the trick of return text.split(begin)[-1].split(end)[0] under the condition that begin/end may not in the text. text = "Hello" text.split("Not In The Text") # ->["Hello"] More
split('a')-kurosawa4434 2 1
don't work for me.... maybe the test cases had been changed. Now, c.swapcase() is do the work. More
1-liner: itertools.compress-Stensen 2
I think it will not work if l[0] is 0. But I did not know "itertools.compress", so thank you for sharing the function. More
First-kdim 1
ciphertext[i::n] I was so close to get this line, but this didn't cross my mind! More
from statics import median-Sim0000 1
\>\> from statistics import median << Wow... just wow.... More
Regex-ezebw2 1
I think string like **" 'example' "** should be matched according to description. ;) re.search("[a-zA-Z']+", text) More
O'REILLY - "Multiple Lightbulbs"-jsg-inet 1 1
As you may know, your code can be shortened: for x in els: if isinstance(x, tuple): all_tuple_list += [x] else: all_tuple_list += [(x, 1)] ==> all_tuple_list = [x if isinstance(x, tuple) else (x,1) for x in els] btw, the code from line 39-56 was written in a way More
First-drill3r92 1 1
Ah, I was you.... But same as mine, your code have bug (in line 7) which you cant delete 0s if there is negative item. And I think there is no statement that items of given list are all positive. (although there is no test with negatives) More
count-Sim0000 1
clever! I use collections.Counter, I didn't think before start writing... More
hard way =)-kdim 1 1
Is this right?: len(max(t)) # in line 4 I think you need the max length of lines, but max(["ebc", "abcd"]) == 'ebc' Seems max(len(t)) is more applicable. More
Split 'a', replace even, remove 'a'-ail531 1
hmm, this has a problem when same items are in a text. like: text = "ababababab" your code return : 'BBBBB' Gold answer is : "BbBbB" More
Second-MuxaJlbl4 1
list.remove is completely new to me, thanks <3 More
First-mega2515 1
It is easy to read, but ">" itself returns bool, so you can write that much short: return len(password)>6 More
First-Steven2222
I think some part of the code (line7-8, 15-16, 10-11) is needless, but still good solution. More
First-ebdavison
No need to escape by yourself, recommendation is to use re.escape(): import re tokens_to_escape = r"\w[]()|" # tokens_to_escape = '\\w[]()|' escaped_tokens = re.escape(tokens_to_escape) # escaped_tokens = '\\\\w\\[\\]\\(\\)\\|' and you can use the escaped string directly int More
OneLiner-InternalError
It's much simple : return len(password) > 6 because ">" operator itself returns boolean. More
split -> reverse -> join-koborC
Let: text = "a b c d" if we use str.split() with no args: text.split() # -> ["a", "b", "c", "d"] if we use str.split() with sep = " ": text.split(" ") # -> ['a', 'b', '', 'c', '', '', '', '', '', 'd'] More
String to list conversion-jurak2012
FYI: String is iterable for i in list(text): is same as for i in text: More
First-kkacc
line 3: we should not use range if index itself doesn't have meaning. for char in number: is better. line 4: number is already string. More
1
2 3