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:(Not very efficient)-JayLee 1 1
Hi, few comments: 1. `lower_case`, `upper_case` and `digit` are actually _boolean flags_. So you can write: lower_case, upper_case, digit = False, False, False 2. Instead of decrementing the value of those three, you can just change their values to True: if s.isdigit(): digi 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
First-HanleyWashington 1
Hi, a small stylistic thing. This would be the correct indentation here: return ",".join(sorted([word for word in first.split(',') if word in second.split(',')])) as _if word..._ belongs to the list comprehension. More
First-inga.s 1 1
Hi, there's a worth-to-learn trick for doing this in Python: `zip(*data)` :) Btw. `new` is redundant. More
First-inga.s 1
Hi, 1. `x` is already an __int__ therefore _int()__ is redundant. 2. _abs()_ is a function and `key` takes a function. Therefore `lambda` is redundant: key=abs # is enough :) More
First-abha_kabra 1 1
Hi, few comments: 1. Line 12 is never reached => redundant. 2. Line 13-15 are also redundant. 3. Your code is not very Python. Fortunately Python is not C. ~~~~ def checkio(array): # You can do this in Python :): # i = s = 0 s = 0 if not array: return s # cleane More
Nth power of the element with index N-inga.s 1
Hi, line 9 is redundant as it's never reached. More
Monkey typing-inga.s 1
Hi, 1. `word` is an __int__ so `return word` is enough. 2. You could use _generator expression_ and the _sum()_ built-in function for this. More
wrapping up the idea-PyPoet 1 1
Hi, `[]` are redundant. Look at _filter()_. More
comprehend comprehension-PyPoet 1 1
Even more elegant solution: return sum(word in text.lower() for word in words) # :) More
Three words-inga.s 1
Hi, 1. Line 9 is never reached => redundant. 2. `if` on line 12 is redundant. More
Secret Message-inga.s 1
Hi, look at _list comprehensions_ e. g.: message = [x for x in text if x.isupper()] # or the filter() built-in function message = filter(str.isupper, text) More
should have known about slicing arrays earlier...-PyPoet 1 1
Hi, 1. This is rather "selfobfuscating" than clear. 2. Look at _extended slices_. Both `indexlist` and `valuelist` are redundant: valuelist == array[::2] 3. `if not array:` better than `if len(array) == 0:` More
The Most Numbers-inga.s 1
Hi, 1. `a`, `b` and `result` are redundant: `return max(args) - min(args)` is enough. 2. Same with lenght: `if len(args) == 0:` More
Normally Solved-Golli19 1
Hi, `bin(number)` is a __str__, which has _str.count()_ method: return bin(number).count("1") More
First-abha_kabra 1
Hi, a little code review: 1. Lines 6-8 are redundant. 2. Parentheses on line 2 and 3 are redundant: if n < len(array): return array[n] ** n # is enough More
First-ciel 1
Hi, `[:n]` is enough. Regards, suic More
Normally Solved-Golli19 1
Hi, this is way to complicated and completely misses the beauty and simplicity of Python: 1. Line 2: `numbers_array` is a __tuple__ which is iterable => _list()_ is redundant. 2. Lines 3, 4: Look at _extended slices_. 3. Lines 6-8: You don't need `tmp` variable as you can swap `j` and `j+1` like th More
Much more pythonic solution-R2R 1 2
Hi, 1. `[::2]` is enough. 2. `if Z else` is even more pythonic. 3. The next step: Get rid off `...if...else...`. Regards, suic More
Normally Solved-Golli19 1
Hi, 1. There's the _abs()_ built-in function: `return abs(d.days)` 2. You can unpack variables with `*` e. g.: d = date(*date1) More