Skip to content

Commit

Permalink
Solution1
Browse files Browse the repository at this point in the history
  • Loading branch information
MykytaPD09 committed Oct 24, 2023
1 parent d9eabde commit d052609
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ def __init__(self, name: str, health: int = 100) -> None:
self.hidden = False
Animal.alive.append(self)

def reduce_health(self, amount) -> None:
def reduce_health(self, amount: int) -> None:
self.health -= amount
if self.health <= 0:
Animal.alive.remove(self)

def __repr__(self) -> str:
return f"{{Name: {self.name}, Health: {self.health}, Hidden: {self.hidden}}}"
return (f"{{Name: {self.name}, "
f"Health: {self.health}, "
f"Hidden: {self.hidden}}}")


class Herbivore(Animal):
Expand Down

0 comments on commit d052609

Please sign in to comment.