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-inga.s 1
Hi, nice solution. Look at [_functools.reduce()_](https://docs.python.org/3.5/library/functools.html?highlight=functools#functools.reduce). Using it, you can avoid recursion. More
len of set-mplichta 1 1
Hi, `if`, `def` and `return` aren't needed. See [my solution](https://py.checkio.org/mission/all-the-same/publications/suic/python-3/using-zip/). :) Regards, suic ```python def all_the_same(elements: List[Any]) -> bool: # bool # /---------------------\ # if len(set(elemen More
regexps and bools-AlexGiesbrecht 1 1
Hi, this is quite repetitive. Let make some comments: 1. _length_ is redundant. Once the length of data is less then 10 you don't need to compute _numbers_, _lower_, _upper_. Python uses short circuit evaluation for _and_ and _or_. if len(data) < 10: return False 2. bool() on line 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
First-MASIAIN 1
Hi, 1. Don't comment obvious things. It's not useful. 2. All that "magic" with `Counter.most_common` is redundant. Regards, suic ```python from collections import Counter def checkio(lis): c = Counter(lis) return [e for e in lis if c[e] > 1] ``` More
First-anonymorf 1 1
Hi, this is not Pythonic for several reasons: 1. Line 2: `words` is a __set__, which is _iterable_ => no need to convert to __list__. 2. Line 4: `words` is _iterable_ therefore: def count_words(text, words): x = 0 for word in words)): if word in text.lower(): 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
Correct Sentence-ouhuazheng 1 1
Hi, 1. `str.capitalize` makes sense if you apply it on string longer than one character. `str.upper` is enough here. 2. Instead of `if text[-1]!='.':` you can use `text.endswith('.')` 3. You can shorten the last three lines like this: ```python return text + "." * (not text.endswith('.')) ``` R 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
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
Digits Multiplication-inga.s 1
Hi, `1` is the _neutral element of multiplication_ lines 8 and 9 are redundant (`total * 1 == total`). You could use the _reduce()_ built-in function for this. More
Three words-theParasite 1
Checking if string is digit by trowing ValueError... Why? Have you heard about str.isdigit()? (check help(str.isdigit)) More
A cool one =)-ermichin158 1 1
Hi, 1. What is creative in this? Checking if a character is uppercase using `ord(symbol) > 64 and ord(symbol) < 91` is quite obvious. 2. You could use _str.isupper()_ for this. 3. Concatenation strings in Python using `+=` is an anti-pattern. More
lambda, 1 line-AmaroVita 1
Hi, in "".join() the [] are redundant. More
First-AmaroVita 1
Hi, you could write r+=['Buzz'] or better r.append('Buzz'). More
First-AmaroVita 1
Hi, parentheses around ",".join(phrases) are redundant. More
yield from-oduvan 1 1
Hi, a "nice misuse" of `collections.Iterable`. There shorter and simpler way to write the same: ```python def flat_list(items): for x in items: if isinstance(x, list): yield from flat_list(x) else: yield x ``` Regards, suic More