Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna-Bordonos17 committed Oct 11, 2023
1 parent f5ff14e commit a6ab82a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ def __init__(self,
Animal.alive.append(self)

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


Expand All @@ -23,7 +25,8 @@ def hide(self) -> None:


class Carnivore(Animal):
def bite(self, herbivore: Herbivore) -> None:
@staticmethod
def bite(herbivore: Herbivore) -> None:
if isinstance(herbivore, Herbivore) and not herbivore.hidden:
herbivore.health -= 50
if herbivore.health <= 0:
Expand Down

0 comments on commit a6ab82a

Please sign in to comment.