20
Splitter
6 26 39
2210/ 2445
Sergei
Last seen 10 months ago
Member for 4 years, 10 months, 12 days
Difficulty Normal
Best reviews / Newest reviews
The Art of the Metaobject Pluralization-flpo 2
It's a smart idea to use 'hour' and 'minute' both for the `lambda` output and as an attribute name. More
First-jusha 2
I guess, longer variable names can be used when there is much free space. Something like `s -> modified_code`, `c -> chars`, `m -> decoded_message`. Also the value of `m` can be formed this way: `m = ''.join(map(MORSE.__getitem__, c))` or this way: `m = ''.join([MORSE[key] for key in c])` More
First-zinryu 1
The line with `return` keyword also can be written as `return len(line) == 1 or rc`. Also longer variable names would be nice because there is free space. More
First-johankor 1
The idea of replacing upper characters with `'_' + char.lower()` is good, but I would implement the idea this way: ```python def from_camel_case(name): underscored = ['_' + x.lower() if x.isupper() else x for x in name] return ''.join(underscored).lstrip('_') ``` Returning to your solution, More
First-jusha 1
Probably `self.defense=0` is not necessary in `Rookie` and `Knight` `__init__` methods. More
First-Sim0000 1 1
Sure, it is concise, but what if someone had to add a new validation? Or 10 new validations. And what about "Sparse is better than dense" from the Zen of Python? More
Politically correct-veky 1 1
Did you use capitalize() instead of upper() in order to show that capitalize() lowers all symbols except for the first one? More
First-bravebug 1
I guess the `isalive` is a little confusing - according to its name I had expected it returned whether a warrior is alive, but it makes an assignment instead it. I would name it `update_is_alive`. Also it seems that initially the `health` is the class attribute, but during a fight `health` instance More
three_words-dannedved 1 1
The approach is interesting. But what about `return True if count > 2 else False` into `return count > 2`? More
First-poojasomani295 1 1
Pretty thoroughly. But I guess it can be simplified. For example this way: ```python def checkio(words: str) -> bool: l=words.split() for i in range(len(l)-2): s=l[i:i+3] if all([str.isalpha(one_of_three) for one_of_three in s]): return True return False ``` More
First-jusha 1 1
It seems that the code works well without `a.append(n)` and with `len(a)` instead of `len(a)/2`. However I am not sure, maybe there are reasons, e.g. to make the code more self-explanatory. More
First-jusha 1
`sorted` takes iterable, including a tuple. More
First-jusha 1
I guess this would work similarly: ```python from collections import Counter def frequency_sort(items): r = [] counter = Counter(items).most_common() for key, count in counter: r.extend([key]*count) return r ``` or this: ```python from collections import Counter def fr More
First-Sim0000 1
Well done, but are you sure about positions of `x` and `y`? I mean `[g[3-x][y]` and `ciphered_password[y][x]`. Do `x` and `y` mean a row and a column, or they mean x and y axes? More
First-johankor 1 1
Is the `TorF` list necessary? ```python def checkio(words: str) -> bool: wlist = words.split() if len(wlist) < 3: return False else: for w in range(2, len(wlist)): if wlist[w-2].isalpha() and wlist[w-1].isalpha() and wlist[w].isalpha(): return More
First-poojasomani295 1
Interesting idea to use and sum a list. More
The Defenders, added method Warrior.hit and rewrote Warrior.fight-vital1312 1 1
The `Warrior.hit` method is smart, but it seems that the `Warrior.get_attack` is not used. Also the repeating unit-to-unit `fight` is a thing to improve. I.e. maybe it would be better to remove `Warrior.fight` static method or to assign the static method to the global `fight` function this way: `fig More
First-jusha 1
I guess, the `if` can be improved. Also it seems that there is no need to use indices instead of iterating through chars: ```python def from_camel_case(name): with_underscores = '' for ch in name: if ch.isupper(): with_underscores += '_' with_underscores += ch More
self.append(vars(text).copy())-veky 1 1
`self.font.join('[]')`, `self.append(vars(text).copy())` and `vars(self).update(version)` and are awesome. But I would replace `def __init__(self): self.restore(dict(contents='', font=None))` with `def __init__(self): self.contents, self.font = '', None` as it is simpler. But it is probably less ed More
Three Words-bravebug 1 1
I guess that this part: else: continue is not necessary and can be removed. More
1
2 3 4