26
Bertrand BENOIT
https://bertrand-benoit.gitlab.io/
Last seen 11 days ago
Member for 4 years, 9 months, 22 days
Difficulty Advanced
Software Architect - Artificial Intelligence R&D Engineer
Very clear and proper solution.
Nevertheless, in the fight function, why don't you use the `is_alive` property, instead of checking yourself `xxx.health <= 0`?
More
Hi @JimmyCarlos, thanks for your solution; if I may suggest:
- you don't need to override `is_alive` because all subclass of Warrior inherits from it
- in `Army.add_units()` why do you check the type of instance? You can directly use `self.soldiers.append(soldierToAdd())`
- you use can replace mo
More
Nice solution, some suggestions:
- you could replace time by _ because you don't use it (and you don't need it)
- use math.ceil instead of the +59 trick
- parentheses are missing in `2*min-100` (I don't even understand how it would pass the tests ?:p)
More
Hi, you may use the default keyword argument of max function, instead of
your final if/else ;)
More
Very nice solution, your way to solve them is always ... special ^^
More
Your solution is Ok but in this case defining s variable is useless. You could either directly replace ir by its value or trick the function adding it as a default argument...
More
Not 'scary' :p
Anyway, your solution is nice; you may initialize y to -1, and move the y
+=1 at the beginning of your while loop, to avoid the else instruction.
More
Dot not work (anymore) with (new ?) tests. Please check your solution again.
More
Nice solution but you should invert the if condition to return asap and
have the following instructions with less indentation and thus more
legibility.
More
Nice solution but why did you put translate4robot outside class?
At least you can define it as a class method...
More
Hey Veky. Nice solution as often. Clear and concise.
Coming back from holidays I'll be able to keep on enjoying checkio 😊
More
Your solution is nice and concise.
You may use str.maketrans, instead of two replace; and called your last
variable 'morse' instead of 'morze' ^^
More
Hi, If I may suggest, you should:
- avoid putting no-warrior logics in the abstract class layer Warrior =>
use method overriding to have only attributes in good classes
- avoid having method in bad class layer (e.g. you should NOT have the heal
method in the Warrior abstract class)
- (optional) put
More
Your solution is not efficient; you should absolutely put the `lower`, and `split` outsite of the loop.
More
Your solution is nice, you can go forward and use a dictionary comprehension to remove one more line.
More
Hi, If I may suggest, you should at least 2 things:
- avoid putting no-warrior logics in the abstract class layer Warrior =>
use method overriding to have only attributes in good classes
- avoid having method in bad class layer (e.g. you should NOT have the
heal method in the Warrior abstract clas
More
Hey. Some suggestions:
- you don't need the brakcets in the first line where you extract hour,
minute and seconds
- you may somehow use map on the same line, to have the same format
(f'{hours:0>2}') on each element
- you may use the 2 replace instructions, on the same line
More