22
adamspj
6 24 40 Leader of the month
2707/ 2945
Awesome Team Paul Adams
Last seen 8 days ago
Member for 4 months, 11 days
Difficulty Normal
Best reviews / Newest reviews
deque (fewer assumptions)-adamspj
I criticized another coder for assuming that any command that isn't POP will be PUSH, so I had to revise my own solution to avoid that assumption. Also avoiding my prior use of queue.append(command[5:]) I hope my new attempt is a little clearer for being more explicit and allows for the code More
match + pop & append-gleb10101010101 1 1
I'm not really a fan of this: case _: q.append(i[5:]) It works, assuming no one is ever going to develop this further, but if we decide later to use something like a "clear" command to empty the queue, might this lead to trouble? I mean, in something as simple as this, no, it w More
First-mazeua
Huh... I at first thought that del s[:1] was a strange choice, as opposed to del s[0]. But then I realized your purpose was to avoid having to test if s. Since slicing won't produce an out-of-range error, it's an interesting little trick, though I'm not sure that it's any faster or clearer than test More
First-sesenion 1
This is good. Using a deque is also a good choice if we expect to process a huge number of commands, but if it's not time-critical, a list does the job. More
comprehension-kurosawa4434
Interesting use of the walrus. I think this could turn out to be really useful if I can remember it and apply it as needed. More
First-Andrew12Andrew
That does the job. Another possibility is to make a group ([A-Za-z]+) and then use \1 for each repetition of that pattern. Not that I'm an expert. I like the power of re, but I also feel like I'm relearning from scratch it every time I use it! More
Three Functions-adamspj
I recognize that I did some unnecessary work creating a sort function that replicates the default sort! Oops. Well, my "New and Improved" solution cuts that stuff out, but I'll leave this here for posterity. Hehe. More
Match case-arnetkachev
This is an interesting and unique approach. More
max(..., key, default)-Phil15 1
I've got to give you credit since I've never used the default argument to max before, and thus I've learned. More
from the nearest to the farthest-David_Jones
I like your approach, and it's far simpler than how I went about it. It's enlightening. I don't really like the "coverage_heights = [0] * 11" even though it does work within the preconditions. I just would have liked to use the max of x-values (max([build[2] for build in buildings])) to make it exte More
First-eugene100372
I don't find this very readable. More
not recurring solusion-tamagoyaki 1
Interesting, though I was a bit confused at first about how you were popping out a list then inserting back the elements into array to be processed again in subsequent iterations. Ultimately, it does make sense. More
Second: No intermediate list, just find it on the fly-ysenko
Ah! It didn't even occur to me to use zip as a way to ensure the lists are of equal length. More
Solution for "Combining Celebrity Names"-zeixes
Cool to see another go at doing this without re. I'm not sure I buy into the named lambda function as a better alternative to putting in two append calls where they fit in (just for readability), but it's cool that there is such variety in the ways we can approach this. And it works! More
without re, 6 lines-kdim 1
Voodoo! But good. I was looking to see how it would be done without re. It's a bit sneaky the way you got the part() function to do double duty, essentially behaving as two functions in one and packing the two different results into a list. It has to be admitted that this is somewhat cryptic, in th More
clear-kdim 1
This was a little hard for me to analyze, but having done the same mission, it made sense to me in the end. The main good thing is I learned from it, particularly the use of the star operator in the assignment right at the beginning. I've never unpacked a list in an assignment this way. The handlin More
Party as a Named list-flpo
Note to self: Practice multiple-inheritance. More
generator-kdim 1
Cool, and yet another thing I have to learn to make use of: "yield from". More
test-oduvan
I can't remember the last time I've seen this use of the tilde operator, but I MUST remember it, as it's quite a convenient little shorthand to use in exactly this kind of problem. More
combinations_with_replacement-kdim 1
You're forcing me to learn a little more about lambda functions and the alias "check" that you used here. It surprised me to see that you could declare pr = primefactors(n) AFTER pr is used in the lambda function, named "check." But it works! I experimented with this in very primitive form: More
1
2 3 4