Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear solution in Clear category for The Warriors by ksc38317
class Warrior:
health = 50
is_alive = True
damage = 5
def hit(self, damage):
self.health -= damage
self.is_alive = (False if self.health < 0 else True)
class Knight(Warrior):
damage = 7
def fight(unit_1, unit_2):
round = 1
while unit_1.is_alive and unit_2.is_alive:
if round % 2 == 1:
unit_2.hit(unit_1.damage)
else:
unit_1.hit(unit_2.damage)
round += 1
return unit_1.is_alive
July 18, 2019
Comments: