57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 20 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.
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
Discussion [here](https://checkio.org/mission/non-unique-elements/publications/veky/python-3/two-bins/#comment-44259).
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
Suggestions? How about [this](https://checkio.org/mission/most-wanted-letter/publications/veky/python-3/key/?ordering=most_voted)? :-)
But generally... if you want to map letters to their counts, a dict is much better structure than a list. You can use collections.OrderedDict if you really need to
More
Many things can be summed, at least conceptually. Look at this: remove `replace_map`, and the transformation in line 8 (`board=game_result`), and replace all `sum`s with `''.join`s (or put `sum=''.join` at the start:).
Then, instead of checking for `3` and `-3`, you can check for `XXX` and `OOO`. M
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
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
I see double! :-P
And `True if (True if f == s else False) else False` is not really helping. Just return `f == s`.
More
Why don't you sprinkle a few more float()s around your code? :-D
Or simply use a normal Python.
More
Wasn't it easier to
for char in text.lower():
instead of lowering each char three times? :-)
Also, highest_letter in line 9 should be 'a', right? If there's no letters, all of them have the same count (0), so you should return the _first_ one alphabetically.
More
Line 12: HA?!
Otherwise, weird ideas of precedence. I don't know any language where modulo has lower precedence than ==. :-)
More
If I could only know what master taught you to use bare except... I'd put that master in a comfy chair for a long time. :-PP
https://realpython.com/blog/python/the-most-diabolical-python-antipattern/
More
I could suppress the StopIteration near the end, but decided this was enough. :-D
More
... a class which has three methods, one of which is `__init__`, and another one is a staticmethod. :-P
Anyway, you can use OO as G-d* intended with a classmethod.
@classmethod
def from_geo(cls, geo_coords):
...
return cls(*map(...))
*] G-d refers to Guido, of course. :-)
More
No, they [aren't](https://py.checkio.org/mission/break-rings/publications/DiZ/python-3/cycle/?ordering=most_voted&filtering=all). :-P
`frozenset((u,v))` looks like an identity crisis. Isn't `frozenset({u,v})` better? :-)
And you again with your negated set operations. :-P
if not set1 - set2:
More