Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
DenPrislipskyi committed Oct 11, 2023
1 parent 8c97b89 commit e559697
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
@@ -1,9 +1,11 @@
class Animal:
alive = []

def __init__(self, name: str,
def __init__(self,
name: str,
health: int = 100,
hidden: bool = False) -> None:
hidden: bool = False
) -> None:
self.name = name
self.health = health
self.hidden = hidden
Expand All @@ -25,7 +27,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 e559697

Please sign in to comment.