57
veky
22 48 64 Leader of the month
44584/ 53887
Last seen 23 hours ago
Member for 11 years, 6 months, 7 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
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
~0my3[_p\x7f{-skunkfrukt 1
Yes, that's how a 7bit washing machine embedded microprocessor would solve the problem. :-D Python has a bit richer data structures on your disposal. :-] (Unfortunately, the code for 8 is not valid ASCII... but neither is its complement. Ah, the good old times of punched cards...:) More
The ... obvious ... way.-smilicic 1 1
... in ... another ... language. :-P More
bad but surprise-magdre 1 2
What's bad and what's surprise here? (except CiO Python finally supports yield from:). I consider isinstance(x, list) a bit nicer than type(x) == list. And it will work for subclasses of list too. ;-) More
First-bukebuer 1 1
Here is your code, halved: import itertools, operator def trim(lists): if lists: first, *rest = lists for t in [first] + [first[::-1]]*(first[0]!=first[1]): for remains in trim(rest): yield [t] + remains else: yield [] def sqgen More
First-coells 1 1
Nice twist. You could have gotten away with slicing (or re.sub), instead of that boring replace. ;-) More
Permutations-Ch0bits 1
That's an ok solution. However, it would be much nicer (faster, shorter, less memory, more readable, more Pythonic) to use generator expression instead of list comprehension. Just drop the brackets []. ;-) More
First-LukeSolo 1 1
Line 7 can be written: if num in cur_alpha. Or better yet, use EAFP instead of twice going through. Just remove lines 6~8, change .find to .index in line 10, catch ValueError and return -1 in that case. More
With itertools batteries: chain, repeat, starmap-flpo 1
Those Lego bricks really fit into one another. :-D More
One line to check them all-LukeSolo 1 1
You don't need second half of or. ;-) More
Dumb Vampire-obone 1 1
Deque might be better as an underlying type for the Army. More
Clear enough-LukeSolo 1 1
You can use sum builtin instead of manual management of count, and you can use enumerate instead of manual index management. ;-) More
No for loop-tralfamafnord 1 1
... but def loop. :-) Nice. Though you didn't really need another function... checkio could be called recursively. :^) More
Perpendicular-bryukh 1 1
Way too complicated. Use complex numbers. ;-) More
max() and special()-OrginalS 1
If you're importing itertools, cycle would be much better fit than count. More
First-coells 1
Nice check whether xor has <=1 set bit. :-) But... * range(0, len(image), 4) would probably be clearer. Or alternatively, at least use my "slice twice" technique: image[i\*4:i\*4+4] -> image[i\*4:][:4]. * x * (1 << j) is simply x << j. More
First-michael.kej 1 1
Line 9 is really head-scratching. :-) begin += -y if y in fib else 1 might be a better way. Also, that alignment is not Pythonic. And that hardcoded fibonaccies are ugly. Much better is to write a generator. More
English to Braille Translator-vinc 1 2
Line 27 can be del braille_out[-1] Also in line 19, you should learn about str.ljust method. It's useful. ;-) In line 10 you don't need a dict: .update(zip(... is ok. Height and width of a Braille character are not likely to change. You seem to me like person defining M = 12 # number o More
First-UndeadMonkey 1
Don't you think this code duplication is horrible? :-P And even that's inconsistent, since units are handled differently than tens and hundreds. Why tab (== lookup) as a separate argument? It's not that it ever changes. Just use that local variable. Why str(tab[...]) instead of just tab[...]? str More
First-Fettn 1 1
A few stylistic remarks, and a big problem: * a-b>0 is much clearer written as a>b (you use it 5 times, and inconsistently) * [building[0],building[2],building[4]] can be written as a slice: building[::2] * you can just say: numberBuildings+=visible at the end, bools know how to count. * The More