57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 13 hours 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.
Everything works well untill that monstrous return. Yes, Python doesn't
have switch statement, and indexing with a bool is fine, but indexing with
2-bit integer constructed from two bools is probably pushing it. int is not
the only thing collections can be indexed with... how about a dict?
{(T
More
Specialcasing what shouldn't be specialcased, sorting to find the minimum, list "comprehensions" which do nothing at all... :-/ A perfect example of how you can't fix the bad code by documenting it. :-]
* What's wrong with treating 0 the same as all the other numbers?
* Imagine you have a thousan
More
Cool. But _why_ `*` instead of `and`?? If you're concerned about repetition, you can use `all`. ;-)
And those lines 5~7 can be written in point-free manner, if you're interested:
has_digit = any(map(str.isdigit, data))
More
Putting obvious solution aside, here is your algorithm written in Python, not in some Lisp-Java mix you've written. ;-)
def checkio(str_number, radix):
import string
result, value = 0, (string.digits + string.ascii_uppercase).index
for exponent, digit in enumerate(r
More
LOL. I'm beginning to like you. You have some potential. ;-)
(Of course, you're aware of bin builtin? Just checking...)
More
Nice handling of empty stack. :-) But the end is just
return not stack
More
Why not simply "return l == list"? Lists are equal, not only their lengths.
More
You're obsessed with lists. :-9 enumerate, .index, and a lot of other things work on many more data structures than lists.
And .index can receive additional parameters telling it where to start and stop checking.
And line 8 is really unnecessary. Much better is to enumerate the _reversed_ num.
Gi
More
Cool. Especially the - grid[row][col] part. ;-)
In slicing, max is unfortunately necessary, since -1 has a different meaning. But min isn't necessary.
r[max(0, col-1):col+2]
works fine.
More
Now when people ask me how dimpleqonx works, I'll just point them to your code. Thanks. :-D
More
Nice adaptive algorithm, but you're doing one thing wrong: when using tau, never say 2*pi in the comments. If you are True Believer in Tau, then you know it is more elementary than pi. If you feel you must "explain", use "turn" or "full turn". ;-)
More
Very nice approach! Is this exact (up to the float inexactness)? I think it is.
More
Nice and recursive. That "except IndexError" is a leftover from when you didn't realize that negative indices would just wraparound, right? :-)
More
This is one of examples where f-string is a total overkill. Of course,
a + b is much better than f"{a}{b}".
More
Line 6 can be solved with filter and str.islower (you don't need re).
Line 7 is just a collections.Counter. And once you have a Counter, it's easy to see the most common element.
copy? Why?! :-)
More