57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 12 hours ago
Member for 11 years, 6 months, 24 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.
Hm, a nice generalization of [my code](https://checkio.org/mission/comp_funcs/publications/veky/python-3/def-def-def/?ordering=most_voted). :-D
More
Since you factored out that much, you could have done it all the way. :-P
More
You're overusing `continue`.
if 0 <= i < len(grid) and 0 <= j < len(grid[i]) and (i, j) != (row, col):
count += grid[i][j]
(Or better yet, `yield grid[i][j]` and `sum` it from outside.;)
More
Bools are ints. And genexps are better than listcomps. :-)
sum(int(bit) == 1 for bit in bin)
Of course, since those int()s are only 0 or 1, even easier solution is
sum(map(int, bin))
More
list of filter of lambda... is just list comprehension.
return [x for x in data if c[x] > 1]
Nice usage of Counter though. :-)
More
Very nice and factored. The only thing left is that _previous_next could
use turn_channel instead of duplicating the code to return the value.
More
You [win](https://py.checkio.org/mission/most-wanted-letter/publications/veky/python-3/key/?ordering=most_voted&filtering=all) the bet. :-D
More
Ok, this is ridiculous. Usually I don't mind some complexity blowup, but
n^4 pushes it. And why str(i) each time?
More
That "return" is lonely down there, without else. :-] No, really, if all the ones above have their elifs, probably it should have its branch, too.
And again you don't need parens around your conditions. You can even
if number % 3 == number % 5 == 0:
More
OMG. At least write some function for checking divisibility, if you don't want to do it the canonical way (`if not number % 5`).
More
[Here](https://py.checkio.org/mission/roman-numerals/publications/veky/python-3/enum/#) is the Roman for comparison. :-)
More
Does your language have the same word for heavy (as a box) and hard (as a mission)? :)
More
`d > -1` has the same number of characters as `d >= 0`. :-P
Also, `sum(map(operator.eq, str(A), str(B)))`. If you hate importing more than dunders, you can use `str.__eq__`.
And `for point in sphere: spheres[d] |= neighbors[point]` is actually shorter than the abomination in line 11. :-]
More
A nice idea, but it really can be solved much more Pythonically. At least you should factor out reversing the number.
More
There are some nice batteries in itertools for that `for for if == break` pattern.
Also, unpacking your cakes would help a bit. And you don't need () inside [] when index is a tuple.
More
You really like that `True if condition else False` idiom? `condition` does the same thing.
Also, see `any` builtin.
More
Nice and surprisingly readable. With all those actions, you're only missing some kind of Journal in your architecture. :-P
More