40
suic
16 39 57
9966/ 10664
Last seen 23 hours ago
Member for 9 years, 11 months, 3 days
Difficulty Advanced
Best reviews / Newest reviews
First-Moff 1
+5 for conciseness and for not using `fnmatch`. Regards, suic More
First-dmbjzhh 1
Hi, 1. The `str` is completely redundant. 2. Don't use reserved words (e.g. `str`) as variable names. Regards, suic ```python return ','.join(phrases).replace('right', 'left') ``` More
First-tigerhu3180 1
Hi, `lambda` is redundant as `abs` is a function (so `key=abs` is enough). Regards, suic More
First-ennisnie 1 1
Hi, `...if...else...` is redundant: ```python # bool # /-------------------\ return True if len(set(elements))<=1 else False # \--------------------------------------/ # bool return len(set(elements))<=1 ``` Regards, suic More
First-davidhqu
Hi, in normally when you have an `if ...: pass` or `else ...: pass` branch then there's something wrong with your code: ```python def correct_sentence(sent): if not sent[0].isupper(): sent = sent[0].upper() + sent[1:] if sent[-1] != ".": sent = sent + "." return(sent) ` More
map-androidbigold 1
Hi, you've actually implemented [`filter`](https://docs.python.org/3/library/functions.html#filter) with `map`. It's a nice misuse :) ```python def find_message(text): return ''.join(filter(str.isupper, text) ``` Regards, suic More
crear-Taka0310 1
This is not speedy. It's actually O(n^2). More
convert into regex-kurosawa4434 1
+5 for not using [fnmatch](https://github.com/python/cpython/blob/3.6/Lib/fnmatch.py) More
An interesting mission-Brda 1
Hi, next time let Python do the job for you (check [extended slices](https://docs.python.org/3/whatsnew/2.3.html?highlight=extended%20slices#extended-slices)). Regards, suic More
First-Cich0sza
Hi, check [`str.isupper()`](https://docs.python.org/3/library/stdtypes.html?highlight=isupper#str.isupper). The square brackets are redundant as `str.join` can consume generator expressions (check the [Glossary](https://docs.python.org/3/glossary.html)) too. Regards, suic More
First-s.shiori.w614ab
Hi, this is "absolute overkill" :) and not very Pythonic: 1. Python `str` has a `str.replace()` method and `in` is the pythonic way to check for substring. Therefore, lines 5 and 6 are redundant. 2. In Python you normally iterate directly over the index. If you need the element's index use the [`en More
First-Moddard
Hi, you can omit the `...if...else...` and replace `len(elements) == 0` with more Pythonic `not elements: ```python def all_the_same(elements: List[Any]) -> bool: return not elements or elements.count(elements[0]) == len(elements) # \----------/ \------------------------------------- More
At last a solution (with a little bit of help from tom-tom and Sukonnik-Illia).-Tinus_Trotyl 1
A slightly reworked version is available [here](https://py.checkio.org/mission/friends/publications/suic/python-3/having-fun-with-tinus_trotyls-solution/). Thanks for inspiration :) More
straightforward-Sukonnik-Illia 1
Hi, you can replace lines 21-25 and 28-32 with set-comprehension e.g.: ```python return { friend for connection in self._connections if name in connection for friend in connection if name != friend } ``` Regards, suic More
First-MrMike 1 1
```python # redundant # +-------------------------------------+ # | | # V V return max([(data.count(x), x) for x in set(data)])[1] # \--------------------------------------- More
Second Composition of Functions-flpo 1 1
Hi, this is nice and correct :) P.S.: A more codegolfish version of `append_dot`: `lambda s: s+"."*(s[-1]!=".")` More
First-yamash-ken 1
Hi, `import re` is redundant. You can use `str.strip()` instead of that regex. Regards, suic More
2-liner: no import, based on gyahun_dash's solution-przemyslaw.daniel 1
2-lines == too long :) Regards, suic P.S.: See [this](https://py.checkio.org/mission/unlucky-days/publications/suic/python-3/przemyslawdaniels-2-liner-one-linerized) More
First-bosse.de.poulet
Hi, `else: pass` is completely redundant. Regards, suic More
Readable-tinytao
Hi, too many comments don't make code readable. Regards, suic More