17
sergray
4 12 34
1484/ 1695
Awesome Team Sergey Panfilov
Last seen 5 months ago
Member for 10 years, 10 months, 8 days
Difficulty Normal
Best reviews / Newest reviews
Clear-yurimelnyk 1 1
Clean and readable. It's better to keep imports outside of the functions though, unless it is to break up some import loops. More
Second-freeman_lex 1 1
Should not it give `False` for `fuzzy_string_match('abc', 'abc++', 1)`? More
Second-tobiasz.kukawka 1
You don't need to keep the old code ;) You can publish different versions independently. It would be better instead ``` for i in grid[row-change_r:row+2]: ``` write ``` for row in grid[max(0, row_num-1):row+2]: ``` More
Count and sort-amandel 1 1
There's no need to provide `Counter` a list built with list comprehension. It perfectly operates on generator expression, which is more memory and compute efficient: ``` c=Counter(x.lower() for x in text if x.isalpha()) ``` `sorted` also has `reverse` argument and lambda function could be simplifi More
First Assignment (non-unique elements)-ilhanmercan 1
Remember https://en.wikipedia.org/wiki/Big_O_notation and learn https://wiki.python.org/moin/TimeComplexity What is O(?) complexity of your solution? Think how to improve performance of your solution in `data.count(x)` and `nonunique_list.insert(i, x)` lines. More
First-tobiasz.kukawka
`data.sort` modifies `data` list in place. What if it is required to keep the original data unchanged? Do you remember complexity of sort? ;) Please separate operations such as `/`, `%` and operands with spaces for readability. You could also write `2.` instead of `float(2)` More
First-tobiasz.kukawka
Could you rewrite it in one loop instead of 3? More
First-tobiasz.kukawka
Nice that you used generator expression and `"".join` for filtering out, but that also means it may double memory usage in the worst case. I like that you used `Counter`, but what if there were no implementation of `Counter`? One character variables and list comprehension with `sorted` call look a More
First-tobiasz.kukawka
Readability counts. Please see https://www.python.org/dev/peps/pep-0008/ I like that implementation is generic in terms of the grid size. Could you rewrite it with index slicing and sum as an exercise? More
First-tobiasz.kukawka
I'll be pushing code style to solutions ;) Unnecessary empty lines, missing spaces between operands and operations :( `(array[n])` could be written without parenthesis More
Simple recursion-nickie
Must be categorized as Clear and Educational solution :) Well done! More
First-RRRQ
Obviously this is not a clear solution. Mangling with indexes makes it hard to read. It is not a Pythonic solution as well, because overwrites builtins such as max, next. map is also a builtin in Python 2. More
Regular Expressions-PositronicLlama
Clean readable and educational solution conforming to the Python code style. The only downside is 3 loops over the same string. More
old school-haiducwork
There's no need to comment in provided function, solution can be put in-place. Let's put the [PEP8](https://www.python.org/dev/peps/pep-0008/) code style aside with spacing between operators and lines ([pylint](https://www.pylint.org/) can be used for automated code style checks). `str` is a built More
House Password-faeton
Nice to see, that the length check can be and is implemented with regex as well. More
First-megaexception
Short and concise. Worth overriding the build-in `sum` function with variable having the same name in such a small scope, but better to be aware of possible side-effects in larger programs. More
First-pohmelie
Multiplication of `sum` by `2` puzzled me for a moment, but overall it's a clear solution. More
chr-joe_5588 1
This is creative, but works only for ASCII More
First-librass
This is overcomplicated without the need and very inefficient. Using `text.count(c)` in the `for c in text` loop doubles iterations over `text`. It is better to name `unsorted_dict` as `char_counts` and add char count every time it is met: ``` char_counts = {} for c in text.lower(): char_counts More
First-lbe
What about cleaning text without regex? Also `Counter` has `most_common` method, which returns `n` most common elements. More
1
2