45
Valentin Bryukhanov
http://bryukh.com/
Last seen 2 years ago
Member for 11 years, 8 months, 2 days
Difficulty Normal
Developer, engineer and taskMaker.
Why?
result_v = check_vertical(matrix)
if result_v:
return True
It can be shorter and simpler:
if check_vertical(matrix):
return True
Or you can simplify the whole function:
return check_vertical(matrix) or check_horizontal or check_diagonal
More
Good solution. But be careful with variables names as **"o"** (also as **"l"**). It can be read as 0 for some fonts. For humans vision :-)
More
Thanks. This is the original solution and interesting method with rotations. It's something new.
More
Nice code!
Not neccessary place your functions inside checkio function. Its can be outside.
More
I didn't get why do you use "*a" here. A input tuple become
a == ((data),)
and then you unwrap it again.
list conversion are redundant -- "sorted" can work with tuples too.
And
"lambda x: abs(x)" is the same as "abs". So you can use "key=abs".
P.S. PEP8 is a good choice for "Clear" ca
More
You don't need line 2. Just `def checkio(number):` if you don't like 'data' name.
More
Simple and clear. And a good idea about "call". Nothing to add :-)
More
"self.connection = connection" is redundant in "add" or "remove" methods. You don't need save them in the instance.
line 7
if isinstance(self.connections,tuple):
Why do you check it in "add" method? You save "connection**S**" in init.
If you are using "if self.connection in to_list_connectio
More