24
Aristoteles Panaras
http://www.checkio.org/user/ale1ster/
Last seen 3 years ago
Member for 10 years, 10 days
Difficulty Normal
Nothing to see here...
Just another human being (even though I wouldn't like to believe so) ;)
It can also be generalized for any NxN matrix by reducing merge on each row.
More
* From the description:
> You should determine whether the specified square matrix is skew-symmetric or not.
* True, so I guess that in the general case (where most inputs aren't antisymmetric) it isn't speedy :)
* .len() is O(1). Also, you know me... I write in a peculiar style.
More
Right now it only removes default port from http scheme.
There must be others though...
Also, the tests do not check for patterns of the form "http://url/sub/subsub/../.."
More
Sorry, I couldn't resist :P
Unfortunately, I forgot to remove the already visited items from the comprehension...
The correct code looks like this:
from math import hypot
from random import choice
def checkio(steps):
dist = lambda a,b: hypot(a[0] - b[0], a[1] - b[1])
More
Do you mean the "in a single traversal" part?
I hadn't thought of it that way, but it's a nice side-effect :P
More
Well, since you went to all the trouble of defining the functions with the same name as the operations, you could do:
def boolean(x, y, op):
return globals().get(operation)(x, y)
unless the python gurus here (@bryukh, @veky, ...) have any objection towards the aesthetics or style.
More