Skip to content

Commit

Permalink
Changes has been made
Browse files Browse the repository at this point in the history
  • Loading branch information
OlenaLis123 committed Oct 2, 2023
1 parent 30d4e7a commit 5a1bda9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ def __init__(
Animal.alive.append(self)

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


class Herbivore(Animal):
def hide(self) -> None:
if self.hidden:
self.hidden = False
else:
self.hidden = True
self.hidden = not self.hidden


class Carnivore(Animal):
def bite(self, animal: Herbivore) -> None:
@staticmethod
def bite(animal: Herbivore) -> None:
if (animal in Animal.alive
and isinstance(animal, Herbivore)
and not animal.hidden):
Expand Down

0 comments on commit 5a1bda9

Please sign in to comment.