27
Last seen 4 years ago
Member for 8 years, 7 months, 6 days
Difficulty Normal
You should confuse your code more thoroughly like this:
key=lambda x:(lambda x:(abs(x)))(x)
sorry 4 that joke )))
More
`checkio = lambda _: Solution()` it`s COOLLL!
than also:
class Solution:
__lt__ = __ge__ = __le__ = __eq__ = __ne__ = __gt__ = lambda *_: True
More
I like your 1-liner very much, but I can`t give 4 stars, because your code is not dry for a little :)
combine = lambda x: ''.join(sorted(x))
and
[combine(c[i] + c[j])) for i, j in ((0, 3), (1, 2), (4, 5))]
More
1. No need erite 0 in
item[0:1] ===> item[:1]
2. String is a sequence so it will suffice to write
alphabet, number = item
3. Following "dry"
guard_1, guard_2 = [( chr ( ord (alphabet) + skew) + str ( int (number) -1 )) for skew in ( -1 , 1 )]
or
guard_1, guard_2 = [f'{ chr(o
More
Falls on:
assert safe_code("19--3=##") == 2
but I think it`s just mark
('--', '-*-') --->replace to ---> ('--', '+'), ('*-', '*(-1)*')
right?
More
grid = [[chr(ord(c) & 0xFFDF) for c in r] for r in grid]
for clear category? Why not just `c.upper()` if it has same result?
from string import ascii_letters
assert all(chr(ord(x) & 0xFFDF) == x.upper() for x in ascii_letters) == True
___
You can use `itertools.product()` for `for in
More
It`s more effective to allocate resources (like "not_repeated = []") after if-statemaent with return.
More
Would be more effective to use list instead str for current
self.current=[] if None else [current]
in __init__() of Text
for write() method use just
self.current.append(text)
and than
''.join(self.current)
in show().
And
self.current, self.font = previous
in restore() instead 2 lines
Othe
More
Due to pep8 we should not use upper-letters for naming variables, except constants. Also would be better to give meaningful names, like "row_count, "column_count", or just 'row' and 'col'.
More
There would not have been this solution without [research](https://py.checkio.org/mission/the-secret-room/publications/Merzix/python-3/caution-pure-magic/share/74103cdf0c2429d922792e9e7179f8ae/#comment-64186) conducted by [Phil15](https://py.checkio.org/user/Phil15/)
More
1.
char.lower() != char.upper()
that will be always True
2) instead
char.upper() == char
just use
char.isupper()
3) more efficiency would be using list, than ''.join(it)
4) list comprehension is mush shotter then simple for consruction
More
The more you compress the code, the more difficult to read it. But it`s very good 2-liners solution.
More
You could use
import string
letters = string.ascii_lowercase() instead of calculating the sequence using magic numbers
letters = [chr(x) for x in range(97, 123)]
Also, use just
retun answer == 26 instead
return True if answer == 26 else False
or even
if answer == 26:
return True
return False
More
I like to read such clear code.
It`s not need to use '.keys()' just "for i in sailors:" or even better " for name, age in sailors.items():
More
May be .split() move to trim() like
def trim(key: list):
key = key.split()
for ... and
lock, key = trim(lock), trim(key) Also if you do not use variable in for use _ for name it
for _ in range(4): Other is good!
More
There is a function for finding (max-min) called [numpy.ptp](http://docs.scipy.org/doc/numpy/reference/generated/numpy.ptp.html) if that's useful for you
max(indices) - min(indices) == ptp(indices)
More