57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 1 hour 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.
Why the exception at all? If the text contains no English letters, it's obvious that "a" satisfies all conditions for the return value. ;-P Relevant quote from Zen:
Special cases aren't special enough to break the rules.
Don't invent counter strategy from scratch (well, from dict:). Instead im
More
Nice obfuscation, but doesn't really work. What if there are non-alphanumeric symbols in the password? Also, if bla==None: return False\n return True always makes me sad. return bool(bla) is much easier to read and to write.
More
What do you think lines 9, 18 and 19 are for? I think you misunderstood what "precondition" means.
More
'ddott' cracked me up. :-D
But really, is this supposed to be in the "clear" category? :-]
Also:
for callback in d.values(): time = callback(time)
More
Decorate-Sort-Undecorate is sooo last century. :-P
The most ironic is that you _do_ use key. :-D
More
Lots of "special" cases that aren't really special. See mine for general solution. ;-)
More
Too many "list"s (in cols).
You don't need () around '\_\_\_' in lines.
You don't need 0 and 9 (len) in slices: inline[::4].
If you're really obsessed with speed, try inlining diags and cols. Also try extending rows directly instead of copying.
More
Aargh. Don't write C# in Python. And _please_ don't use pseudoHungarian notation. It completely misses the point of Python.
Also, learn Python idioms. Many of your lines can be written in a clearer, sometimes even point-free way. In some cases you don't even need to learn new idioms, just use them
More
Why didn't you just put s=0 in line 1, then you don't need line 2 at all?
Also, len() is unnecessary. Sequences are boolable.
More
Nice. Of course, can be expressed with any.
any(word.endswith(suffix) for suffix in words_set for word in words_set - {suffix})
Or itertools.permutations, if you're in the mood. :-)
More
To paraphrase Blaise Pascal, "I have made this solution longer than usual, because I lacked the time to make it short". ;-)
More
ROTFL.
But it would be way more cool if you mapped OPERATION_NAMES to symbols from "∧∨→⊕≡" instead of relying on indexes. This is not maintainable. ;-P
More
Just out of curiosity, do you really, honestly consider your solution _readable_?!
Mixing lists, tuples and strs without any plan or order, tackling those "or ld.count... or rd.count..." on like an afterthought (which it probably is) instead of mapping through them too, using max instead of any (
More
Instead of type(,,), use class. It's not so old-fashioned. :-P
Instead of defaultdict(int), use Counter. Much more explicit. ;-)
Instead of subclassing tuple, use complex. It naturally adds by coordinates. ;-]
And instead of tuple(map(lambda: setattr...)), bite the bullet and write a for loop onc
More
I think set(blah) & set(nyeh) is still nicer than set(blah).intersection(nyeh). But not much.
More