57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 14 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.
Meh... I meant some more fancy arithmetic. :-P E.g.
total += (abs(complex(x, y)) >= radius) * 4 * (1 + (x != y))
More
Again, obsession with lists. `merged` is the true solution, line 13 is just bureaucracy. :-)
More
Yup, that's factored. But since you already use the slice in line 7, it would help you in line 6 too.
... or parts[-1:] != ['..']
More
No, lambda is not your problem. Superfluous parentheses/brackets are your problem.
Of course, regexen are always the second problem. (http://regex.info/blog/2006-09-15/247) :-P
Also, logic. And escaping things.
https://py.checkio.org/mission/three-words/publications/veky/python-3/godel-gentzen/
More
Nice usage of 3D numpy array. But the initialization could really be more
compact... at least those dots after 0 and 1 shouldn't be there.
More
By "new_" you actually mean "old_", right? :-P
But seriously, Python has math.gcd. It also has fractions.Fraction, BTW. :-]
More
This is really wrong, and shouldn't be "Editor's choice", except as an example of how not to do it.
>>> checkio(int('1'*89, 2))
32
And the link (which really shouldn't go into the docstring, but into a comment - I am appalled at how often people confuse docstrings and comments) nicely says
More
Lines 15~20: wasn't it easier to say
if 3 in sums: return 'X'
elif 12 in sums: return 'O'
else: return 'D'
Or better yet,
return 'X' if 3*1 in sums else 'O' if 3*4 in sums else 'D'
More
Isn't `.split(' ')` the same as `.split()`? And isn't `int(blah, 0)` the same as `int(blah)`? Remove those arguments and see. ;-)
More
Since you factored out that much, you could have done it all the way. :-P
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