57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 14 hours ago
Member for 11 years, 6 months, 6 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.
Instead of stuffing components of date1 (and date2) separately into date initializer, you can splice them at once:
date1 = datetime.date(*date1)
Also, you don't need outer parentheses in last line.
More
ROTFL. Although it has some cases where it doesn't work (there are other chars in letter and number blocks that are not letters nor numbers), it did make me laugh. You can make it even more cryptic if you want:
checkio = lambda data: len(str(len(data))) > 1 >
__import__("functools").
More
You don't need "+" in your regexen (you even don't have it in the first one:). And you don't need r here, though maybe it is good to always write it to remind you of regex parsing. But the last one then really ought to be \d. ;-)
Also, you don't need bool around the first condition, and even on the
More
Nice reorganization into tens and dups, but the code has some horrible duplication. You can do much better. ;-]
Here is an interesting approach, that tries to stay faithful to your algorithm. Of course, if you're willing to depart a little from your original algo, you'll be able to write much bette
More
Too complicated and ad hoc. BTW you don't need () around num%3 and num%5.
More
Nice idea, but you really could just break instead of += 'N'. It doesn't really have a purpose. :-)
More
When an identifier (like sum here:) is purple, it's subtly trying to tell you something. Namely, Python already has a builtin you can use here.
Also, whenever you see range(len(, you should probably use enumerate.
And, len(array) is unnecessary inside []. array[-1] is the last element.
"if len(ar
More
Again you're writing comments instead of code, misunderstanding the main purpose of Python. For example, line 34. Why is it there?? Wasn't it more to the point to write
chr(most_frequent + ord('a'))
or, in fact much better,
LETTERS.lower()[most_frequent]
Those doctests are cute, but a bi
More
Line 23: never index by index. Pythonic way is to index a dict.
"not len(stack)" is simply "not stack" (twice). And in line 18 it can be reversed for greater clarity.
Many of these comments are either completely redundant (like line 8), terminologically wrong (like line 5, Python term is a "sequen
More
Those "names" don't really help, if you must break the 80col boundary. sorted\_data is just one char shorter than sorted(data), and semantically completely empty, while "list\_length" is such a bad name that it should be taken outside and shot. :-P
More
Wooow! FT in singledigit number of lines. Totally cool. :-)
However, I can't give you more thumbs, since you artificially limit the degree of polynomial. Have you thought about using 1 << expr.count("x").bit_length()? I think it wouldn't slow you down much, and you'd have a general algorithm.
More
Really too complicated, and not working with Pythonic data structures. get_positions is really criminal in that regard.
More
Well, this is my solution, so I don't know if it is ok to vote on it. It's just an ordinary topological sort, with lexicographic (native) tie breaks. Nothing fancy.
More