57
veky
22 48 64 Leader of the month
44584/ 53887
Last seen 18 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
DivMod Solution-LewisFogden
Wouldn't code be _much_ simpler if you had FIRST_TWENTY = [""] + FIRST_TEN + SECOND_TEN TENS = [None, None] + OTHER_TENS ? :-) More
Slow?-LewisFogden 1
Slow is smaller problem. Bigger problem is, doesn't work for more than 1000 numbers in data. :-P More
by the power of radix!-LewisFogden
from string import digits, ascii_uppercase value = (digits + ascii_uppercase)[:radix].index ... int_value += value(digit) * radix**pwr Much better than hardcoding "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ". More
Nasty Solution-LewisFogden
set([left, right]) ~~~> {left, right} Or better yet, lines 3~6: sets = [set(link.split("-")) for link in network] Lines 9~12: if i is not j and i & j: Lines 14~17: return any({first, second} <= i for i in sets) And of course, algorithm is horrible. :-P More
Checking Lists-LewisFogden
Argh, code triplication. :-P Wasn't it easier to collect them all in one place? Or better yet, write a generator? def lines(): yield from gr yield from zip(*gr) yield [r[i] for i, r in enumerate(gr)] yield [r[~i] for i, r in enumerate(gr))] for line in lines( More
A Bit Long?-LewisFogden
WOVELS = set("AEIOUY") CONSONANTS = set(string.ascii_uppercase) - WOWELS samekind = lambda a, b: {a, b} <= WOWELS or {a, b} <= CONSONANTS zip(word, word[1:]) is enough. c not in separators. And you very rarely need parens after not. What do you mean, "tried c.isalpha()"? Didn't work? :-) All in More
Bin man-LewisFogden 1
bin(number)[2:] ~~~> format(number, "b") int(b) for b in blah ~~~> map(int, blah) More
Clean and Simple-LewisFogden 1
Lines 2~4: feed, birds, new_birds = number, 0, 1 Line 7 really should have been written if feed <= birds: More
First-BossRaker
"This mission is simple to solve", but you still managed to botch it. :-P More
code reuse reuse-StefanPochmann 1
You mean code (reuse reuse)*. :-] More
First-k_dutch
functools.lru_cache does it all for you, and more. ;-) More
Second-Taca
That numpy cannot be used doesn't mean you should go medieval on ranges of lens. :-/ map(sum, matrix) map(sum, zip(*matrix)) Also, lines 22 and 23: nice usage of enumerate, decorate-max-undecorate, key and itemgetter, but you could have just sums.index(min(sums)) BTW [see second para More
First-Taca 1
This becomes ridiculous. You solve everything with re? :-D b = "".join(x for x in expression if x in "()[]{}") Also, not everything is a list. ;-) And you should decide _what_ name you want, instead of giving three names to the same object. :-D Lines 13~16: just return not b. More
First-Taca 1
Line 3: mapList doesn't have to be a list. "abcdefgh" will do just fine. Lines 5~7: just write "for k, l in pawns:". Don't range(len(. Ever. :-) Also, not everything is a list. If you removed line 2 and made difence (defense?) a set (just put {} instead of [] around comprehension), you could just More
Non-Unique-nathan.l.cook
iElement is a very strange name. Do you come from the Kingdom of Nouns (also known to its denizens as Java)? :-) More
Methodical Check-nathan.l.cook
Your complicated protocol has a name: **and**. ;-) return digit and upper and lower and len(data) < 10 And a nitpick: you don't need + in your regexen. ;-) More
Brute Force-nathan.l.cook
Line 13 is the right idea, but can be taken much further. Do you notice that you're always accessing FIRST_TEN and oneToNineteen (BTW why not till19?:) with offset 1, and OTHER_TENS with offset 2? FIRST_TEN[:0] = [None] OTHER_TENS[:0] = [None, None] (or just change them inline). And then u More
Straight forward brute-nathan.l.cook
Do you really need to find if number of elements is odd _before_ you sort the list? Last time I checked, .sort didn't change the length. :-) if len(data) % 2: And yes... what exactly did you intend to accomplish with line 3? Are you really saying that listLength is somehow clearer than len(dat More
Checker function-nathan.l.cook
Instead of returning [], you should return None. That is, just delete lines 4 and 5. def outcome((a, b, c)): if a == b == c != '.': return a Why do you turn everything into a list? For example, line 9 is completely unnecessary. Not to mention that the whole first part is un More
First-nathan.l.cook 1
Line 8: [] is a strange name for a set. That's the main problem with your comments anyway: they are incredibly misleading sometimes. You probably come from some programming language where it is much more important to explain things to compiler than to the human reader. In Python it's the opposite: i More