45
Valentin Bryukhanov
http://bryukh.com/
Last seen 2 years ago
Member for 11 years, 7 months, 16 days
Difficulty Normal
Developer, engineer and taskMaker.
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
At first look i thought "This is not a puzzle. I see indents and docstring. It's clear solution and Veky didn't write it" :)
But then... You broke my brain. Now i have the puzzle for weekend.
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
Column programming style :-) it's something new. I think you should move this in "Creative" :-)
More
You forgot about spaces around operators (pep8).
if cell[0]==10 and cell[1]==10:
You can make it simpler
if cell == (10, 10):
line 4 -- "== 1" is not necessary
if lab[cell[0]][cell[1]]:
line 13-17
min(paths, key=len)
But for the shortest path you can use BFS
More
It's Depth-first search, right?
Interesting using of "for...else.." construction.
But it's bad practice to change input list.
More
It's not DRY (Don't Repeat Yorself). You can merge four block for moving in one loop or function. And "return" without anything is not good -- it's little confuse.
Good comments.
More
Hard to read long lines.
For unsolvable puzzle, you can check solvability (count inversions).
More
it's not fast -- i know, i can cached some variants for speed. But sometime i am lazy :)
More
Great solution. Simple for understanding. I agree with Kvas about Fraction -- slow thing. But this solution easy modified to float. So it's not important. Thank you for interesting solution.
More
:) Thanks for this solution. It's funny, really. Crazy blind adventurer :)
More