57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 20 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.
That three loops could all be just one loop.
And "if d in string.digits: dig += 1" can be written as just "dig += d in string.digits" (or even simpler, "dig += d.isdigit()").
Lines 14~17 are just: return bool(len(data) >= 10 and upc and dig and loc)
More
OMG. Ok, you didn't know about math.gcd (nor fractions module...), but not knowing about builtin `abs` function is simply inexcusable. :-P
More
Instead of giving my comments a shower of minuses, I think it would be much more productive to [learn some Python](http://www.checkio.org/mission/x-o-referee/publications/veky/python-3/trick-or-treat/). WETness of this code is staggering.
BTW, not everything is horrible up there. Last line is prett
More
Nice. A few hints:
Adding four characters to line 1 would shorten your line by fourth. :-D
from itertools import combinations_with_replacement as C
Also, despite PEP8 (which you don't care about anyway:)
def checkio(data): return blah
can be written as _real_ one liner :-)
More
LOL. It's possible to be exact and _much_ simpler than this. But this is nice reading. :-D
More
Everything you wrote can be excused, except "Thus".
Seriously, if you're obsessed with milliseconds, you shouldn't write Python at all. You'll just be frustrated. There are much faster languages (where you can be obsessed about nanoseconds;).
More