22
Last seen 3 years ago
Member for 10 years, 1 month, 5 days
Difficulty Normal
Good news everyone! The very first solution I have no idea why it works...
-- Hubert J. Farnsworth
More
For string input it is easier to use function eval() (line #14-20)
x,y,z = eval(data)
In Python 3 you don't have to convert to float explicitly since a/b results by default to float (line #15-20). Therefore m,n,r will always be float.
For result string it is '{0:g}'.format() that you ha
More
I just finished reading of HARLIE2.0 by D.Gerrold, your exec*n kinda reminds me of HARLIE
More
ROFL, I came through 10+ best solutions and yours is the only one to solve diofantic equation. Nice.
More
So this is how code-review looks like :-D At least you re-used ASCII from the original. ;-)
More
Hmm, if this was an online test, our solutions would be marked as exact copies, that would be bad...
More
I have noticed before that you're using exceptions to handle conditions, mostly for fun, I guess. Why in this case? While cycle would be way easier.
More
We have pretty close ideas about solutions.
Line 5 might be simplified this way.
args = {(arg % min_arg or min_arg) for arg in args}
More
Lines #7-8 can be simplified using tuple assignment
first_name,second_name = relation.split("-")
Even better, you can unpack tuple to simplify lines #7-9
add_names_to_map(*relation.split("-"))
Lines #30-32 are same as simple return False.
Also relations_map should not be a global va
More
Your solution is actually same as mine except for estimation of value of n.
I only wonder why did you choose top\_n=num\*\*0.5? If you look at triang\_sum(), you could use finer value of top_m=(num\*6)**(1/3) instead.
Lambda keyword should also be preferred in case of your inner functions.
More
Inspired by Haskell infinite structures I had to solve problem with very limited recursion depth ... and solved it! Not a singe directive, only lambdas allowed.
More