jumboframe

Untitled

Jul 17th, 2021
636
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     def count_objects(self, object_type, objects):
  3.         return [object_by_type for object_by_type in objects if object_by_type.__class__.__name__ == object_type]
  4.  
  5.     def animals_status(self):
  6.         res = f"You have {len(self.animals)} animals"
  7.         for animal_type in ["Lion", "Tiger", "Cheetah"]:
  8.             animal = self.count_objects(animal_type, self.animals)
  9.             res += f"\n----- {len(animal)} {animal_type}s:\n"
  10.             res += "\n".join([animal_t.__repr__() for animal_t in animal])
  11.         return res
  12.  
RAW Paste Data