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
Short, but not speedy.-tommycarstensen
Hi, line 5, 6 are almost the same. It's a good candidate for `lambda` or list comprehension. More
First-carloszampiere
Hi, forget about semicolons, please :) More
First-carloszampiere
Hi, 1. `lados` is redundant. `args` is a tuple => is iterable, so _list()_ is redundant. 2. you should decompose `args` like this: a, b, c = args 3. You don't need _math.sqrt()_, there is the [_pow()_](https://docs.python.org/3.4/library/functions.html#pow) built-in function, and the `**` ope More
First-tommycarstensen
Hi, 1. Line 6: [] are redundant. 2. Look at _filter()_ cnd = collections.Counter(filter(str.isalpha, text.lower())) 3. Line 7 that `for x sorted(): break` is so ugly. What's wrong with?: return sorted([t[0] for t in most_common if t[1] == cnt_max], key=operator.itemgetter(0))[0] More
First-roman.maksymiv
Why not?: def exclusive(x, y): return not(x == y) def equivalence: return x == y def implication: y if x else 1 More
First-vak123
Hi, this is two times the same code as you perform the same set of operation on _first_ and _second_. A few suggestions: 1. You can use sorted(x) instead of x = list(x); x.sort(): x = sorted(x.lower()) 2. You can avoid the redundancy mentioned above with a separate (or even nested) _ More
First-vak123
fib += [age] is the same as fib.append(age) More
First-vak123
A _for_ loop would be a better solution for lines 5-10 e. g.: for rep in (('IIII', 'IV'), ('VIV', 'IX')...): large = large.replace(*rep) __*__ before _rep_ unpacks the tuple. More
First-ls67
There's a lot of redundancy: 1. You don't need to import string at all as you can use str.islower, str.isupper, str.isdigit. 2. Lines 8, 10, 12 contains the same pattern and also redundant checks: # For example: if sum([1 for c in data if c in string.ascii_lowercase]) == 0 More
One-liner-suic
Thanks. Today I would do it differently. :) More
Complicated a bit-OlegDurandin
Hi, I have two things: 1. Use str.join instead of resString + for loop (in this case ",".join()) 2. list() is redundant on line 3 sorted() can consume sets. More
Simple solution in thee strings-OlegDurandin
Hi, two things: 1. list() is redundant as sorted can consume str. 2. lines 2 and 3 contains the same pattern, you could make it function or lambda function. More
Three words-EfGnevsheva
Hi, `return` is a statement not a function. Parentheses are redundant. More
Three is a crowd-maurice.makaay
Hi, in fact the if is not necessary here as you can write: any(len(word_group.split()) >= 3 for word_group in re.split(r"\d", words)) More
Re-cardinam
Finally a solution with {2} :) More
First-reggiec
On line 9 you have three time the same pattern. You can use map/generator expression/list comprehension instead. E. g: all(map(str.isalpha, wordlist[i:i+3])) # or all(i.isalpha for i in wordlist[i:i+3]) More
Three words-Scotty
Hi, once you've found 3 word you can return immediately: if count == 3: return True More
Monkey Typing-EfGnevsheva
Hi, this is not pythonic. E. g. line 6: `if s in text:` More
First-fickas
Hi, don't use `sum` as variable name. You certainly know that it's a name of a useful built-in function. _sum()_ in action: if not array: return 0 return sum(array[::2]) * array[-1] More
First-WolfgangBuehnemann
Hi, look at extended slices and _sum()_: sum(array[::2]) More