57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 21 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.
Flat is better than nested, indeed. :-D The only thing you missed is that
you could write line 25 as
cube_volume = 3..__rpow__
:-D
More
You were very close with that "key". ;-)
return max(sorted(map), key=map.count)
Also, you don't need re. You can just use "abcdefghijklmnopqrstuvwxyz" (also known as string.ascii_lowercase) as first argument to max, and key=text.count as second. But then it's too easy. :-D
More
Yes, of course complex numbers are a natural representation of 2D. But you can go _much_ further. For example, instead of dirs[dir_idx], you can just use (-1j)**dir_idx. The set of complex numbers is not just 2D vector space, it's also a field. ;-)
More
Those Lego bricks really fit into one another. :-D
More
"Improvement" depends on the criteria. I surely think that just trying the bases until one works is more intuitive than calculating the maximal digit value --- but of course, the second one is faster.
More
... but def loop. :-)
Nice. Though you didn't really need another function... checkio could be called recursively. :^)
More
This code has an enormous amount of duplication. But removing all the duplication would make the code twice longer. ;-)
More
That's how I planned to call my solution, bit there might be children around. 😛
More
Not a bad idea, but can be much better done. Instead of heaviside you can simply use bool, but if you want another function, a better idea is to eliminate the duplication for hours and minutes. Something like pluralize(hours, 'hour') and pluralize(minutes, 'minute'). Or even count('hours') and count
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
This one is the most similar to mine, I guess. But still a bit more complicated. :-)
More
Yes. You're just missing a bit of math, and a thorough knowledge of the standard library. :-)
More