57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 21 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
First-StarkyLife 1 1
Line 4 doesn't serve any purpose, you know? :-) In fact, you can just return the expressions from lines 6 and 8 directly. But it's nice to name at least the return value, when the function name is totally uninformative. ;-) "!= 0" can be removed from line 5. Read it as "if there is a remainder". I More
First-tivvit 1
I think set(blah) & set(nyeh) is still nicer than set(blah).intersection(nyeh). But not much. More
Second-Sim0000 1 1
Lot can be factored out from this. See my solution. ;-) More
First-coells 1
Don't write empty except. It almost never means what you think it means. For example, imagine someone confuses order of arguments, and calls index_power(3, [1,2,3,4]). You'd want TypeError, right? But you get -1. :-( More
root of unity-coells 1 1
Now you're just showing off. But I like it. :-D More
Sum of pigeons-LukeSolo 1
Since you have two lines anyway, how about extracting definition of l to separate line? :-) Also, you shouldn't use mutable defaults unless you _really_ know what you're doing. ps=() is much better. (Usually, = in default definitions doesn't have spaces around it. At least PEP8 says so.:) More
Cloud number n in ... e ...-veky 1 1
Thanks @StefanPochmann (do you ever sleep)? More
First of The square chest-grigoriytretyakov 1 1
inside is just `max(divmod(top-1, 4)) < 4 - length`. And set([spam for egggs]) is `{spam for eggs}`. And if you return a set(sides) from square, you can just use subset operator (`square <= lines`) in the last line. More
First-nsmirnoff 1
:-) Even if you _did_ want to convert words to a list (though there is no reason for that here), there is a nicer and explicit way: for y in list(words): More
hard way-theholy7 1 1
Pytonic way of writing switch is not enormous ifchain, but a dict. Great advantage is that names and codes are next to each other, so you can see what's what. def boolean(x, y, operation): code = dict( conjunction = x and y, disjunction = x or y, impl More
Raising head and cutting tail-LukeSolo 1
If you really want a faster algorithm, use collections.deque instead of list. Line 8 is O(n), and deque.popleft is O(1). More
oneliner-tivvit 1
Instead of lambda with \*, you can use `operator.mul`. Or if you don't want to import one module more, you can use `int.__mul__`. int(z) is duplicated, since this is the reverse of usual listcomp paradigm: you need map first, then filter over that. So you can use the building blocks directly. More
Bubble without bubble-tivvit 1
Why line 6? Tuple has all the interface you need. Nice algo, of course it can be expressed with sum. sum(val1 < val2 for end, val1 ... for val2 ...) More
Hack?-LukeSolo 1 1
Eta-reduction applies here: checkio = \_\_builtins\_\_['s''um']. And as you see, + is not needed. ;-) More
WET-veky 1 1
Inspired by Zlomovsky's [Lambda-91](http://www.checkio.org/mission/count-neighbours/publications/zlomovsky/python-3/lambda-91/#comment-26172) (also known as "WET is shorter than DRY":) solution. They just didn't take it to the extreme. :-D More
First-a7295177 1 1
BASE.find(str_number[i]) really could be factored out. Instead of that ugly index manipulations, you can use enumerate (and possibly reversed). More
First-santosh.pagare 1 1
Lines 4,5,6: digits = lowers = uppers = 0 Line 1: unnecessary. :-) Lines 8~13: digits += c.isdigit() lowers += c.islower() uppers += c.isupper() or if you insist on using unbound method, remove initialization and just say digits = sum(map(str.isdigit, data)) Lines 15~18: More
One-liner-a7295177 1 1
Nice idea, but really too complicated implementation. See: checkio=lambda t:3*"True"in"".join(str(w.isalpha())for w in t.split()) More
First-martin.beseda.3 1 1
Line 1 expression can just be "secs // 60 + (secs % 60 > 0)". bool _is_ int. ;-) That antipattern in lines 10~13 really should have been using collections.Counter. Learn about it, you'll love it. ;-) Lines 16~19 are _precisely_ the reason why Guido finally added conditional expressions to Pyth More
First-asa119 1 1
An interesting approach. However, a minor point: you can initialize them all at once (see below) and a bit bigger point: flat is better than nested. Indentation is cool, but is not really optimized for such nesting. This is probably better: if len(data) < 10: return False upper = More