57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 17 hours ago
Member for 11 years, 6 months, 6 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. In this case, simple is not better than [complex](https://py.checkio.org/mission/humpty-dumpty/publications/veky/python-3/complex-battery-staple/?ordering=most_voted&filtering=all). :-P
More
defaultdict(float) would be a nice thing to use for jars.
But really, there is a closed formula. Go smoke a peace pipe with algebra. :-D
More
It's much better to use
if command.startswith('POP'):
since when you change POP to something else, you'll likely forget to change the 3.
Also, line 5:
if queue:
More
You could have written it even longer. Though I don't really know how. :-P
More
A bit more Pythonic than the previous one, but still not very Pythonic.
Line 2 is unnecessary. How many same arguments you'll have? And each of them will clear that inner loop in 2 steps.
Line 3 is simply wrong. gcd(2, -4) is 4. And gcd(0, 5) is 5. "greatest" is by divisibility, not by standard or
More
Why do you keep thinking your solutions are Pythonic when they _obviously_ aren't? Superfluous comments, duplicated code, and that mortal sin of Python programming, "except: pass".
More
Your matrices obviously aren't. The good question is, why? :-) And more importantly, why do you think this is clear? :-P
More
There is really no reason for a separate function. Lines 10~22 should just be up there, instead of line 4.
Also, instead of naming the result (with those unfortunate parentheses), it would be better to return it immediately.
if f_result is g_result is None: return None, 'both_error'
More
First, `from string import ascii_uppercase as lnums`.
Second, why specialcasing digits?
(string.digits + string.ascii_uppercase).index(digit, 0, radix)
More
It always fascinates me when people see one line where I see four. :-D
Anyway, first, doesn't this code duplication make you nervous? :-P
Second, why general **kwargs when you only need key?
def max(*args, key=None): ...
More
You really like those parentheses, hm? 25% of them are unnecessary. :-D
Fraction(1) is good enough. :-)
And Fraction(dron, n) should be factored out.
More
Inspired by [this](https://py.checkio.org/mission/funny-adding/publications/andrea.manno1/python-3/string_addition/#comment-49362).
More
You're aware that you can use chr/ord (instead of str/int) uniformly for both coordinates? And when you look at it that way, that 4-way repetition really calls for a separate function, doesn't it? :-)
def shift(character, offset=-1):
return chr(ord(character) + offset)
Also, `len([pos
More
It's much easier to sort inplace: `data.sort()`.
Subtracting 1 only to add it 2 of 3 times when you use half_index doesn't seem like a good investment. :-o
Also, don't use int(a/b), use a//b. First code leaves you at the mercy of C double arithmetic, second one is exact.
>>> int(1234567890123
More
Very clear? I don't really think so. :-o See [this](https://py.checkio.org/mission/calculate-islands/publications/veky/python-3/floodfill/?ordering=most_voted&filtering=all) for a few ideas.
More
The goggles, they do nothing! :-o
Also, see [this](https://py.checkio.org/mission/colder-warmer/publications/veky/python-3/parentheses/share/ddd4befd4b0caa50d7008f47d3c64640/#comment-5463) comment as a demotivational poster. :-D
More
Very nice. A hint: Python's grammar is smart. You don't need parentheses in lines 7 and 8.
More