Skip to content

Commit

Permalink
Simplify_logic
Browse files Browse the repository at this point in the history
  • Loading branch information
oboliziuk committed Oct 22, 2023
1 parent 6a1c571 commit fad2544
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ def __repr__(self) -> str:

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


class Carnivore(Animal):
@staticmethod
def bite(other: "Animal") -> int:
if isinstance(other, Herbivore) is True and other.hidden is False:
if isinstance(other, Herbivore) and not other.hidden:
other.health -= 50
return other.health

0 comments on commit fad2544

Please sign in to comment.