19
Luděk Reif
Last seen 1 year ago
Member for 8 years, 3 months, 20 days
Difficulty Normal
I understand the solution, but beware to using this in actual project. regex could be slow, especially for long texts and used _findall_ function.
More
Good solution, for return **\_\_repr__**, you can use unpack locals variables with **\*\*locals()**. -- *return "Building({self.south}, {self.west}, {self.width_WE}, {self.width_NS}, {self.height}".format(\*\*locals()*
More
There's is a better way to test `is_alive`, simply:
def is_alive(self):
return self.health > 0
`fight` could be used `is_alive`. `fight` function is only a little bit messy for me, it could be better divided.
And better practice is make functions for actions, not only use the inne
More
Good solution.
You can combine your indexes to one number and test i-11 or i+9.
More
sorted is useless here -- I used it for previous speedy solution and I didn't remove from this solution
More
You can improve your code. Don't use re, you can just compare 2 lists without spaces and solution will be shorter and faster.
More
There's no need if-else, you can return result of comparison. Function list is no need too.
More
Solid solution, you can do it on one line (just idea for improving :): return sum(array[::2])*array[-1] if len(array) != 0 else 0
More
One line solution: http://www.checkio.org/mission/even-last/publications/ludek.reif/python-3/one-line/
More
"if number % 15 == 0" could be better instead of "number%5 == 0 and number%3 == 0".
More
There are unnecessary variables, you can save result of _replace_, _strip_ or _split_ back to variable _text_. Or you can return all of them in single line.
More