40
suic
16 39 57
9964/ 10664
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Best reviews / Newest reviews
First-GelaGela 1 1
Hi, you could write return [i for i in data if data.count(i) > 1] More
First-gmixo 1 1
Hi, you can shorten the last line like this: return all(f.findall(data) for f in (r1, r2, r3, r4)) or you can go even further: # Lines 4-7 contains the same pattern rx = re.compile(regex) # You can extract the pattern and make a list comprehension or generator expression r1, r2, More
First-dedked 1 1
Hi, [] are redundant. Tip: Look at _filter()_. More
There must be better ways-PyPoet 1 1
Hi, 1. _is_ isn't the right way to check equality here, use `==` instead. 2. You don't need the first `if` branch: if setItem1 != setItem2 and setItem1 in setItem2[-suffixLength:]: return True 3. But as it's been already mentioned: _str.endswith()_ is a better option. 4. Check the [_a More
First-StaticFuzz 1 1
Hi, nice solution. You can shorten it: new_list = sorted(list(args)) return new_list[-1] - new_list[0] if new_list else 0 More
Biiiiiiiiiig if-JanKaifer 1
Hi, why not: return (game_result[0][0]==who and ...) That `if...else` is redundant. More
First-metallidog 1
Hi, there's nothing wrong with this solution, but you can make it more concise: 1. bin(number) is a _str_ so you don't need str(). 2. This: count += (x == "1") # is the same as if x == "1": count += 1 At the end because bin(number) is _str_ you can omit the count variable, More
First-tofol 1 1
Hi, at first sight I was a bit surprised that it works :) as __is__ isn't the right comparison in this case, there should be ==. I have a few comments: 1. The condition in the first if is a precondition for this task, so you could omit it. This condition you could write in a more Pythonic (math-lik More
First-chrisblazier 1
Man... why??? 1. Forget about `else: pass`! Those lines do nothing. 2. Use `if` wisely: answer = count >= 3 # is the same as: if count >= 3: answer = True else: answer = False 3. `answer = bool`? Why? Why not `answer = True`? Or why don't you return immediate More
First-Marpop 1
Hi, look at [_sum()_](https://docs.python.org/3.5/library/functions.html?highlight=sum#sum) built-in function. More
secret_message_twofors-mmngreco 1 1
Hi, __str__ is immutable in python, so it's not the best type for accumulation. Tip: Look at _filter()_. More
digits_multiplications_txt-mmngreco 1
Hi, you can use _reduce()_ here: return reduce(int.__mul__, map(int, num_txt)) More
three_words_binary-mmngreco 1 1
Hi, `lambda` is redundant: for e in map(unicode.isalpha, words.split()) More
First-GelaGela 1
Hi, for non-empty array: array[-1] == array[len(array)-1] More
One-liner after some help from Sim0000... thanks!-zebulan 1 1
Hi, you could use lambda and \_\_import\_\_() to make it one-line-one-liner :) More
First-nkapliev 1 1
Hi, I have a few comments: 1. You can omit the if ... else. return sum(map(lambda word: word in text, words)) 2. I think list comprehension or generator expression would be better here. return sum(word in text for word in words) More
monkey_typing_twolines-mmngreco 1 1
Hi, generator expression would be nicer. Or you can write: return sum(map(text.lower().__contains__, words)) More
Non-unique Elements-Riddick 1 1
Hi, you missed a bit the concept of list comprehension: You could write: new = [i for i in data if data.count(i) != 1] or even: return [i for i in data if data.count(i) != 1] More
days_between_lambda_date-mmngreco 1 1
Hi, that `lambda` is not necessary. You can use `*` for unpacking, e. g.: days(*date1) More
First-tsumakazu 1 1
Hi, 1. Last if is redundant: `return x >= 3` 2. On line 7 you can immediately `return True`. More