40
suic
16 39 57
9966/ 10664
Last seen 1 day ago
Member for 9 years, 11 months, 4 days
Difficulty Advanced
Best reviews / Newest reviews
First-Ivan94 1
Hi, this is redundant: if data.count(x) == 1: continue Why not: if data.count(x) > 1: z.append(x) More
First-rrsony22
Hi, 1. That `if...elif...elif` is redundant. Those are not special cases. The only special case is _empty list_. 2. Don't use semicolons in Python. 3. Those `B-E` variables are redundant. Why not?: return sum(array[::2]) * array[-1] More
First-solgrey
Hi, that `n + 1` is redundant. You could write: if len(array) > n: return array[n] ** n else: return -1 # or even: if len(array) > n: return array[n] ** n return -1 More
First-YoannD
Hi, this is the same: return firstWLcCounterList == secondWLcCounterList is the same as: if firstWLcCounterList == secondWLcCounterList: return True else: return False More
First-YoannD
Hi, 1. Look at __Counter__ from `collections` module. 2. Instead of lines 13-16 you could write this: return sorted(counterList, key=lambda x: x[1], reverse=True)[0][0] 3. Instead of `alphabet` you could import `ascii_lowercase` from `string` module. More
First-YoannD
Hi, this is not pythonic. Look as _list comprehensions_. Again: Those `print`s are useless. More
First-YoannD
Hi, remove _print()_ before publishing. More
First-YoannD
Hi, 1. code from line 5 is redundant. 2. you don't need _re_. There is _str.isdigit()_ method. 3. you don't need `...if...else...` as you could use _bool()_ instead or, when you replace that _re_ with _str.isdigit()_ you can simply remove it. More
First-gtuk 1
Hi, look at _sum()_ built-in function and _extended slices_ e. g. `array[::2]`. More
using recursion-gtuk
Hi, this is not pythonic. Look at _str.join()_ method. More
I spend way too much time on this...-Ceph3 1
... two thumbs, but those [] on line 59 are redundant :) More
op_dict-CaptCalculator 1
Hi, __bool__ is subtype of __int__, so you don't need those nested ifs and inner functions. For example: def equivalence(x, y): return x == y # or: equivalence = lambda x, y: x == y More
bin int done it-CaptCalculator
Hi, 1. you don't need `[]` as _sum()_ accepts generator expressions. 2. you don't need _list()_ as _bin()_ returns __str__, which is iterable. 3. instead of _int()_, you could simply `sum(i == "1" ...)`. 4. in fact you don't need _sum()_ at all. Upon closer inspection, that `sum()` from no. 3. is s More
First-jnye
Hi, 1. That `for i in text:` is useless. 2. You don't need `[]` in _str.join()_. 3. Look at _filter()_. More
First-jnye
Hi, look at _sum()_ and _generator expressions_: sum(i in text.lower() for i in words) More
First-jnye
Hi, this is an overkill: 1. Look at _extended slices_ e. g. `array[::2]`. 2. After some clean-up: def checkio(array): if array: evens = [] for i, v in enumerate(array): if i % 2 == 0: evens.append(v) return sum(evens) * array[-1] ret More
First-jnye
Hi, 1. Line 5: `if not u: return []` 2. You don't need __Counter__. 3. Look at other solution, which use simple list comprehension. More
First-jnye
Hi, 1. that last `if...else` is redundant, you can directly return your condition. 2. or you can move that if inside the for loop: if ...: for ...: ... if n and u and l: return True return False More
First-MAODANDAN
Hi, line 2 is redundant as `arg` is iterable, you don't need to convert it to a list. More
First-MAODANDAN
Hi, look at _extended slices_. More