57
veky
22 48 64 Leader of the month
44583/ 53887
Last seen 13 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.

Best reviews / Newest reviews
972 liner-Juge_Ti 1
ROTFL. How much time did it take? :-) More
First-marshall.zheng
You're reinventing the wheel. See Counter in collections module (standard library). More
dict FTW-veky
If you're trying to see how it works: just print(r) between lines 5 and 6. I'm sure you'll see what r is, and then the rest is pretty obvious. (Of course, if there are any questions, just ask.) More
Pandemonium-veky
This is just to show various methods your system can be cheated. Fix these, and I'll find new ones. :-P More
Restricted Prime-shreekar
Reverse Eratosthenes. Cool. :-D BTW, set([]) is just set(). More
First-Amachua
That's the algorithm I used. Thanks for writing it in long form. :-) More
Inefficient monster-gflegar
If you like using external stuff, those little lambdas are already there: change "lambda x, y: y/abs(y) * x" to "math.copysign" change "lambda x, y: x * y" to "operator.mul" Batteries included. ;-) More
DP-gflegar
Yes, that's the obvious one. :-) More
Commented-Miaou
LOL. This is the reason why I don't comment my code. :-] There would be more comments than code. :-) More
First-jcg
,key = lambda x : (x[0],x[1]) isn't really needed in line 32. More
First-gflegar
Last line is just return s*(n == 1) And yes, you could have get rid of that special case (given your hate for special cases) in line 2. For example, return (s + (not s))*(n == 1) Here you do need parentheses around not, since it is special in grammar. But "not" being special enab More
First-gflegar
Again, no parentheses around "not s" are needed. You never need them when you use it as a logical condition, only as an arithmetical expression. BTW sentinel really could have helped here (to reduce number of cases:). See mine. ;-) More
First-qria
Line 3: nice optimization, but it's not like we have millions of elements. list.index would work perfectly fine. :-) Line 5: str is also just a (kindof) list of characters. "qria" is probably more readable than ["q", "r", "i", "a"]. Lines 37~40: you _should_ feel bad. Not because of hardcoding More
Happy splitting-hanpari 2
So, you see the problem? How can using str.endswith (which is intended for exactly this kind of check) not be clear, and at the same time using c.split(d)[-1]=="" is somehow "clear"? Everybody considers their code clear. That's why this whole category thing is nonsense. More
First-dirk86 1
Sorry, *= max( , 1) is very unclear to me. But this is obviously ridiculous. Everybody considers their own code clear. More
First-coells 1
Your idea of "functional programming" is very strange. Hint: lambdas and foldrs are not everything. :-D See math.hypot, operator.and_, itertools.product, and itertools.starmap. And sorted returns a list already - what did you think, it will return an iterator? :-] More
Third-coells 1
Yes, that's the way (a-ha, a-ha,) I like it (a-ha, a-ha). :-D As a nitpick, I think that manual for-loop could be automatized (written as a real for loop), with while inside to repeat a single pass until d<0. But this is probably ok too. More
Second-coells
A nice variant of my "Ordered" solution. :-) Is there _any_ reason to use d << 1 instead of d*2 (or even nicer, d+d :)? You just need parentheses for it. BTW, in Py3.4, max finally got a "default" argument (despite Raymond's cries:), so you don't need that ugly line 4. :-] More
Second-coells
Nice complex key. :-D But you don't have to search through the whole text, just through a..z. :-) More
First-coells 1
Awww, iter, finditer, and even _itertools.chain.from\_iterable_. Awww. :-D Haven't you buried the idea of your solution a bit too deep? :-] More