30
Олег Домокеев
Last seen 1 year ago
Member for 6 years, 1 month, 9 days
Difficulty Normal
I like this clear solution. Thank you. One can easy understand the logic of algorithm: for every pair find the line -> count the amount of dots on this line -> determine line with max dots.
It's very unusual for me to use the linear regression to fine the line for two dots, but why not. May be this
More
My respect for the comments to the code. I'll try to use this like standart
More
Nice and clear. But I think that the search of disconnected_nodes could be simpler.
More
The solution is not, may be, the shortest. But it is very clear and readable. The idea to use nested while-loops is very creative.
More
The code is clear. Only two remarks
First: You could use standard method pop() instead new method get_item()
Second: You do not need use if-statement in function add_units (for example: soldier=unit() self.units.append(soldier)
More
I like the method hit in class Warrior. It makes the function fight very simple.
More
It's very interesting that you operate with hole multiline string. It is very useful for me because I almost always try to split and make a list. Thank you.
More
Do we need parameter 'is_alive: bool = True' when we have '@property
def is_alive(self):
return self.health > 0'?
More
the block 'else: pass' is always unnecessary. You do not need to use it.
And you could try list comprehension instead append method
More
Numpy is very power tool. Thank you for the example of the use of it.
More
Very clear solution. I've learned much about how to use scipy, especially for the task or linear programming. But the linprog gives us the float values, but we need integers. Then you truncate the result. I'm not sure, that we obtain the true solution in all possible cases.
More
It's perfect
Only one remark:
I place of break You could use return in if-statements. return True in first and return False in second. So you do not need the last line.
More