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
If you want to go wacky, what about return (a ** ((a | 1 ) / (1 | a))) * (b ** ((b | 1) / (1 | b)))
More
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
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
This is helpful in several ways, including the for look catching two values and the illustrative use of setdefault.
More
Sorry, this is not "clear". It may be clever, but the terseness is the opposite of clear. It reduces readability.
More
I've got to give you credit since I've never used the default argument to max before, and thus I've learned.
More
It's clever and aesthetic as a kind of concrete poetry (look at the cascade of indents!), but it's not very readable. It's a puzzle of sorts (which ultimately makes sense when it's "solved" by the reader). I'd categorize it as "creative," but for the sake of clarity, add some comments. E.g.
\# Chec
More
You've shown good knowledge of the .strptime() and .strftime() methods. However, you could avoid rebuilding the format of iso datetimes by using the lfromisoformat() and .isoformat() methods instead.
It's good to see you returned a string as requested. So many solutions did not; they often returned
More
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
Wow, this was mind-bending for me because I'd never before tried using logical "and" and "or" between non-Boolean values. I tried to compare in my mind to bitwise & and |, but that wasn't right. I learned the right way once upon a time, but forgot it because I never actually put it to use. But now I
More
The "range(len(items)-1,-1,-1)" feels a little clunky. You could try:
for i in range(1, len(items)):
if not items[-i]...
More
Hmmm... I guess subtracting max of lists of zero works, though I'd think an if statement is clearer for reading.
More
I like the c = instructions.count. Whereas I don't always like abbreviating function (method) names like this, in the particular case, where the whole thing is simple, the readability of the code is actually improved and it remains perfectly clear.
More
Apparently the "Ko-Ri-An" (Hanguk-eo) language expresses "I love Python" by saying "I Python Python"!
Fun, though.
More
This looks very straightforward to me. It's easily readable, and readability is very important to me.
More
Looks good. Note, also, that you could have done:
for _ in range(i):
since you didn't really need the value x in your code.
More