57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 15 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.
Eh, your puny lookup table... why don't you go [all the way](https://py.checkio.org/mission/roman-numerals/publications/veky/python-3/lookup/?ordering=most_voted&filtering=choice)? :-D
More
... [because reasons](https://img.memesuper.com/5eb915f485390b6b68f2ab5eb6ecd9c3_the-because-x-meme-from-meme-because-reasons_512-446.jpeg)? :-P
More
That's a really roundabout way from letters to numbers.
How about
from string import ascii_uppercase, digits
lookup = (digit + ascii_uppercase)[:radix].index
Also, you should learn to [iterate properly](https://nedbatchelder.com/text/iter.html).
More
Now try to remove one pair of parentheses. ;-D
Also, you seem to have a [muffinhash problem](https://youtu.be/o9pEzgHorH0?t=381). `from datetime import datetime` might be better.
More
When all you have is a hammer, to the outsiders, everything looks like a thumb. :-P
len([x for x in f if not cond1 and not cond2]) == 0 ~~~> all(cond1 or cond2 for x in f)
More
When you're bad, be truly bad. :-]
filter('0'.__ne__, str(number))
Of course, much better is
filter(int, str(number))
\- not bad at all. ;-)
More
And what do I do now? Give 4 stars to the first one, and 2 stars to the second? :-P
More
That max with 0 seems really ugly in a Clear solution... having another if would be too much for you? :-)
More
The same as [Aperiodic](https://py.checkio.org/mission/periodic-table/publications/veky/python-3/aperiodic/), only readable. :-D If you ever wanted to see how that one worked, but didn't have courage to tackle it. :-]
More
Meh. Still too complicated.
(0,4,8)[blah] is just 4*blah
and
(not x-y) is just (x==y)
More
Kernighan says "flatten your if/else chains". Judge for yourself whether this makes clearer code. :-)
More
All those len tests are unnecessary and unpythonic.
if len(stack) > 0: ~~~> if stack:
if len(stack) == 0: ~~~> if not stack:
Not to mention
if len(stack) == 1 and stack[0] == '': ~~~> if stack == ['']:
More
What's the point of having a good solution in the docstring, and then an inferior one in the code?
More
`max` has a `default` keyword, too, which you can use to avoid lines 5 and 6.
Also, re's forward looking might help you so you don't have to extract `group(0)` as a separate operation.
More
Nice usage of 3D numpy array. But the initialization could really be more
compact... at least those dots after 0 and 1 shouldn't be there.
More
The other bit operators being bit_length (log2), population (count of 1s), majorification (round up to power of 2), bitshift by one, and inverse (~).
More
Impressive! However... :-D
Are you sure that it's impossible to put _conjunction_ in the MSBs, so you can enjoy 2 or even 3 free zeros at the beginning of your magical number, instead of only 1 as you do now with equivalence?
It won't be _shorter_ (though of course it would be awesome if you could
More