13
xtofl
1 10 25
723/ 845
Kristoffel Pirard
Last seen 4 years ago
Member for 9 years, 9 months, 23 days
Difficulty Normal
Best reviews / Newest reviews
First-Ablepsicgod
Why the slices? `x[0][0:1]` can be perfectly written as `x[0][0]`, since we're dealing with strings here. The artificial 'not' should probably be replaced by simply `None`, and then you also get rid of the trailing `!= 'not'`. A syntactic sugar used by many is the condensed equality form: More
Eval (downvote scapegoat)-ale1ster 1
using 'eval' feels like cheating... More
First-hanpari 1
This is the first solution I see that sticks to the task and returns integers. Although 0 and 1 will coerce to False and True, of course, which would make it shorter :) More
First-chaz.ruhl
Linear search through the if-statements can easily be replaced by a dict of functions. And returning True and False just obfuscates the meaning of the code: simply returning a predicate should do. More
First-dagger126
Indexing the given OPERATOR_NAMES just ties your code tightly to the order the operators are defined in. Tight coupling should be avoided at all cost - at least in a program where maintainability is an issue. Also: the | operator is a 'bitwise or', not your old 'logical or' (cfr https://wiki.pyt More
First-blabaster 1
After reformatting (no runtime cost :) return sum( sum( ((0,) + l) [col:col + 3] ) for l in (((0,),) + grid)[row:row + 3]) - grid[row][col] Great find to just subtract `grid[r][c]` in the end! What is the use for `((0, ) + l)` as opposed to just ` More
First-adithya217
Coming from C, this is a very clear solution. The vast number of conditions, nested loops and `continue` statements makes it hard to relate to the problem statement. Python offers [generator expressions](https://wiki.python.org/moin/Generators) to simplify this greatly. You should give them a t More
First-Eldin 1
very clear, expressing the `neighbors` as a plain tuple! Alignment can make these coordinates visible at a glance: [-1, -1], [-1, 0], [-1, 1], [ 0, -1], [ 0, 1], [ 1, -1], [ 1, 0], [ 1, 1] It takes some time to understand the `tempx, tempy` expression - as dedicated and clear More
No need for Lambda -ahmedaswai 1
You know that `x.__contains__(y)` can be (and should be) written as `y in x`? More
First-yarkcy
Quite clear solution. Checking for the second letter is an unneeded twist; you're lucky there is no 'ROTATE' command. The `else` branch in your loop is unneeded, too, though it makes the program more robust, analogous to the ability to POP from an empty stack. In order to keep a larger interpret More
First-KangLee
Style remark: variable names tend to start with lower case in Python code. `queue[len(queue) - 1]` can be written as `queue[-1]` `Answer += 0`... why? Your can lose clutter by reversing the condition: if queue: answer += queue[-1] `print(answer)`: is that a debugging left-over? More
119-DiZ 1
`len(c)` can be replaced by just `c`. You must have lost your enter key somewhere :) More
First-xiongbiao 1
`if len(n) != 0` can be written as `if n`. More
1
2