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

Best reviews / Newest reviews
158-DiZ 1
Hehe... mine is almost as short, and I didn't even try to golf. :-) More
Simple as hell-kamitenshi 1
Of course. Or just sum them directly. :-) More
DP-gyahun_dash
If superior is local, getgain surely should have been local too. Then it wouldn't need enemy as parameter, same as superior doesn't need numsp and sumsp as parameters. repeat and chain.from_iterable, wonders from itertools. But might it be better to use collection.Counter, with its .most_common? ` More
UGLY : When Coffee Is not an Option-robby.daigle
Lines 16~18: how about if s[-2]: ? :-) More
Oh Lambert, My Lambert :)-hrvoje
http://www.checkio.org/mission/super-root/publications/veky/python-3/utilities/?ordering=most_voted Not complicated at all, just compressed. :-D More
First-xiaozhan 1
If you're going to import things, you can also import mul from operator. :-) Also, here you can also eliminate []s (you must use () since it is not the sole argument). Or even, since this pattern (map, then filter) is awkward to express as a comprehension (that's why you have duplicated int(i)), yo More
First-xiaozhan 1
Yes. BTW default quotes in Python strs are _single_ quotes, for a good reason. Get that C/Basic monster off your back and reduce visual clutter: ','.join(phrases).replace('right', 'left') More
First-oglop
This one is nice. Of course, once you get the "sum of bools" pattern, you'll see a much more direct way of writing such things. ;-) More
First-xiaozhan 1
Don't comprehend into a list if you don't need a list as a whole, just numbers one by one (and sum expects exactly that). You save memory, and reduce line noise. sum(item for index, item in enumerate(array) if not index%2) Of course, that particular pattern of indexing is probably better expre More
First-xiaozhan 1
That lambda can be written much easier, if you understand Python's object model: it's just str.isupper: ''.join(filter(str.isupper, text)) (BTW ''.join to me looks much nicer than "".join. But that's just aesthetics.:) More
First-xiaozhan 1
Again, instead of mapping lambda, much clearer is to use generator expressions: sum(x in text.lower() for x in words) Or, in this case, you can simplify that lambda into an immediate function: sum(map(text.lower().__contains__, words)) It has certain advantages: for instance, text is low More
First-ILQU 1
Your code has a weird mix of using //2, /2 and /2.0. (That's probably the consequence of using Py2.:) Either stay with Py2 (without `from __future__ import division`), use `/2` and `/2.0`, or (much better;) switch to Py3, where you use `//2` and `/2`. Also, length should be properly spelled. Or jus More
Holly *, this is short!-veky
It's even shorter than @StefanPochmann's :-O "*" in the title stands for 'Grail', of course. ;-D More
veky - 3 + fast-StefanPochmann
[Beat ya!](http://www.checkio.org/mission/weekend-counter/publications/veky/python-27/holly-this-is-short/#comment-35810) More
First-rojeeer
Nice idea in line 8. ;-) "high_one" is probably better named "ten". ;-) And the order is a bit weird. 1,5,10 is what I would expect. Calls can be simpler with roman += roman_unit(hunds, *'DCM') (And the first one can also be `roman_unit(thous, *'M__')`.) Instead of assert, why not just retu More
First-rojeeer
This is a classical example of how readable names are much better than comments. Look: def checkio(food): time = pigeons = 0 while food > 0: time += 1 pigeons += time food -= pigeons Of course, recovering last values would not be needed if yo More
First-rojeeer 1
Instead of returning a list and converting it to a set, why not return a set directly? :-) safe_pawns = lambda pawns: len(pawns & set.union(*map(defend_pos, pawns))) Or better yet, learn how to write and use a generator. More
First-juzzuj
First, `data.isalnum()` is unnecessary. Second, operators are better than methods. You can use &, you convert one operator to set anyway. (But _bound_ methods are better than operators. See below.) Third, that huge "condition" can just be returned as bool. if something: return True return More
First-juzzuj
I'm sure you've realized that Counter is not really the simplest way to solve this. But if you insist... :-) You probably used Counter for performance. It's funny because after that you use _two_ sortings (one with .most_common), and both of them are linearithmic and unnecessary. :-] min and max ar More
Non-recursive and resetting-juzzuj
First, do you really need randomization? You shouldn't, this is a deterministic task. At least you should seed the generator to something fixed. Second, you really like these set methods, hm? Sometimes conversion is much better: not a.symmetric_difference(b) ~~~> a == set(b) Again, indi More