14
Artem Golovatiuk
Last seen 2 years ago
Member for 5 years, 8 months, 26 days
Difficulty Normal
Are you sure it will count correctly the number of dogs on a vertical line?
More
Are you sure that
sum(k * j[0] + b == j[1] for j in coords)
finds the correct number of dogs on the vertical line?
You will have the same j[0] for all of them, but different j[1]
More
It would be a better idea to clean up the "debugging-prints" before publishing the solution, since it is a bit hard to check what is going on with lots of random printed output.
More
There is a full range of letters in the 'ascii_lower' constant of 'string' library.
It could be more convenient to use it, instead of specifying all the letters by hand.
And it is definitely faster if we count the "development" time :)
More
The possible values for coordinates are up to 10 (included). Are you sure
such code will work if we take 10 as X or Y coordinate of some point?
And I would suggest better using "numpy" math functions if you already
imported it. They are more robust and work faster.
More
The solution does not account correctly the separate trees.
For instance, you can have 2 big enough trees:
is_family([['Hugh','Logan'],["Logan","Mike"],["Logan","Jack"], \
['Anrew','Jho'],['Jho','Stew'],['Jho','Meow']]) == True
However, it has to be false as there are 2 trees.
More
Great idea with generalising %12 rule! Now this will help me to not confuse
12 a.m. and 12 p.m. in everyday life :D
More
I suppose it would be more convenient to import the library outside of the function, so it doesn't get re-imported each time one runs the function.
More