57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 19 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.
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
How long will it take you to discover real keyword arguments? :-P
def min(*args, key=lambda x: x):
More
If you want both div and mod, there is no reason to do the work twice. :-)
while number:
number, digit = divmod(number, 2)
ones += digit
((Of course, `bin(number).count('1')` is too simple.:))
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
Wasn't it better, since you already made a copy in line 2, to destroy the copy (lines 7 and 10) than the original argument? :-)
More
> Do not understand how it done
Then how did you write it? :-)
Especially I'm interested in that list(zip(...)) thing. I'm talking about exactly that in one of my VCRs. ;-]
Also, didn't it occur to you to write just _one_ operation, and then iterate it in a loop instead of madly copy-pasting code
More
What's the contest: how to write it using a maximal number of lines? :-D
More
For understanding of what? Most convoluted way to solve this task? :-P
Decorate-Sort-Undecorate is so 20th century. :-P
More
Aaargh. You remind me of Tom Petty, "Learning to fly (but I ain't got wings)". ;-9
More
Yup, count the quadrants. But it can be done much easier. See my solution. :-)
More
return min(abs(...) for i in ... for c in ...)
And that's it. :-)
More
Argh. I _think_ you have the same algo as I do, only in about 10 times more lines. :-o
More
Meh... at least you could factor out e calculation (see my solution for single-case approach:). And since you're already importing math, was it so hard to tack on sqrt, too? :-)
More
You don't need to verify input represents real pawn configuration. :-)
More