From fad2544fff33c17bd06dd8021bb0e64f8ad85f47 Mon Sep 17 00:00:00 2001 From: Oksana Boliziuk Date: Sun, 22 Oct 2023 21:38:06 +0300 Subject: [PATCH] Simplify_logic --- app/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 35e729ae..14ea66e7 100644 --- a/app/main.py +++ b/app/main.py @@ -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