57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 1 day 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.
Nice using of higher order lambdas. Base case can still be simplified with
whatever if data else 1
istead of
data[0][0] if len(data)==1 else whatever
More
5 methods (for transforming strings) being: re.sub, zfill, replace, translate, and slicing.
More
Funny, but: first, Counter is really not needed, max can have key too. And second, tuples can be keys (ordered) - no need for base 42. :-)
More
So, you see the problem? How can using str.endswith (which is intended for exactly this kind of check) not be clear, and at the same time using
c.split(d)[-1]==""
is somehow "clear"?
Everybody considers their code clear. That's why this whole category thing is nonsense.
More
Yes, this is in some way even simpler than mine. Nice work.
BTW, enumerate(accumulate(list of length 1... OMG. I know what you were thinking, but *sometimes* range(len( _is_ the right thing to iterate through (with slicing). :-D
More
LOL @ RPN. :-D
I think you'll find it even easier to generate infix expressions. See mine. :-)
More
Nice use of default arguments. ;-) BTW why a commented checkio above?
A nitpick: wouldn't
c if b else a
be nicer than
a if not b else c
?
More
ROTFL. I admit I was staring at that 1/ for a few minutes. :-D
For translated, maybe it would be nicer to first starmap(complex, data)?
More
Please don't use "concatenating digits in a large base" as a method for selecting by multiple keys. Unicode has more than 1e5 code points (if not now, then soon:)). Tuples comparison is exactly meant for this. Key should be (count, -ord).
Also, this algorithm has quadratic complexity, while the t
More
Nice and complicated. :-P Wouldn't dict be more appropriate data structure for z?
More
First, if you _used_ regex here, that would be remarkable. Not using Python re here is like not using a bicycle for swimming. :-D
Second, argh. Please don't do
if c: return True
else: return False
if c binds something bool. Do
return c
Token count just went from 7 to 2. A
More
Yep, a lot more code than needed. BTW you get a Special Confusion Award for using " ".join on a str. :-D (And then .split() right after that.:)
More