39
CDG.Axel
18 36 55 Leader of the month
9398/ 9695
Axel
Last seen 2 months ago
Member for 2 years, 9 months, 8 days
Difficulty Normal
Best reviews / Newest reviews
Second (='ω'=)-Magu 1 1
you can replace "if args != ()" with "if args" More
my solution-defensor 1 1
you may try enumerate to avoid using "buildings.index(floor)" More
One liner - sorting dict items-Pelmen323 1
you can use -x[1] instead of x[1] and omit 'reverse=True' More
recursion-kdim 1
short solution! btw you can use all possible moves list to remove one 'c +=' line [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)] More
First-Phil15 1
Great span find and merging cycle! More
First-PythonLearner 1
great solution! btw you can shorten first function to one line return tuple(...) if tree[1] else return ({tree[0]}, ) More
dictionary comprehension-spitfire_ch 1 1
you may use sorting by tuple (abs(value - one), value) and avoid dictionary using More
simplified-dbirmajer 1 1
you may avoid comprehension and indexing by key function using return min(values, key=...) More
itertools cycle reversed-juestr 1
Thanks for long but interesting solution! More
First-robertabegg 1
You may first join phrases then replace all in once More
Geometry Figures-tssrkt777 1 1
Great abstraction and polymorphism using! But for my solution I economize with volume(). I made it non-abstract with 0 result ) More
Caesar Cipher (decryptor)-tssrkt777 1
you can use this for alpha shift (need no string module and try-except): chr(97 + (ord(s) - 97 + delta) % 26) and next step looks like pack it all to one line ) More
Best Stock-tssrkt777 1 1
Looks like my first solution... Btw max(..., key=...) could help to improve code :) More
Text Formatting-tssrkt777 1
По идее костыль возникает из-за того, что когда вы добавляете слово к строке, вы всегда добавляете пробел сзади. Имхо проще так добавлять слово к строке: line += ' ' * bool(line) + word More
Second: not a one-liner, but stepping through the list with next() to try and fail fast-leggewie 1
It's interesting, but your solution 25% slower than this for sorted list: return items == sorted(items) and len(items) == len(set(items)) # 0.75 More
Chess Knight-tssrkt777 1 1
Let's start optimization from step_finder(): def steps_finder(x, y): STEPS = [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)] return [[x + dx, y + dy] for dx, dy in STEPS if 8 > x + dx >= 0 and 8 > y + dy >= 0] and the tail code (after res = []): r More
regular expression-hbczmxy 1
In the second part of code you may simply replace '()', '[]' and '{}' strings to an empty string for i in range(len(expression)): expression = expression.replace('()','').replace('[]','').replace('{}','') More
First-libeadier 1 1
You may improve some constructions: - sorted(res.items(), key=lambda x: -x[1]) instead of using 'reverse=True' - use sorting by tuples helps you remove 2 or three lines More
Bigger Price-tssrkt777 1 1
Splendidly! But 'reverse=True' looks too heavy ) Hint: you may sort by -value for reverse sorting More
complex is better than complicated-veky 1
Thanks for remembering complex numbers for map tasks! It helps to shrink my solution to 10 lines: https://py.checkio.org/mission/lantern-river/publications/CDG.Axel/python-3/complex-isnt-complex/ More