class Animal: def __init__(self): self.__number_of_legs = 4 self.__number_of_hands = 0 def look(self): return "Number of hands: {hand}, Number of legs: {leg}".format( hand=self.__number_of_hands, leg=self.__number_of_legs) class Bird: def __init__(self): self.__number_of_legs = 2 self.__number_of_wings = 2 def look(self): return "Number of wings: {wing}, Number of legs: {leg}".format( wing=self.__number_of_wings, leg=self.__number_of_legs) class Feline(Animal): def __init__(self): Animal.__init__(self) self.__characteristic = "Felines belong to the cat family" def look(self): return super().look() + "\n" + self.get_characteristic() def get_characteristic(self): return self.__characteristic class Tiger(Feline): def __init__(self): Feline.__init__(self) self.__characteristic = "Tigers can roar and are lethal predators" def get_characteristic(self): return super().get_characteristic() + "\n" + self.__characteristic class WildCat(Feline): def __init__(self): Feline.__init__(self) self.__characteristic = "Wild cats can climb trees" def get_characteristic(self): return super().get_characteristic() + "\n" + self.__characteristic class Canine(Animal): def __init__(self): Animal.__init__(self) self.__characteristic = "Canines belong to the dog family" def look(self): return super().look() + "\n" + self.get_characteristic() def get_characteristic(self): return self.__characteristic class Wolf(Canine): def __init__(self): Canine.__init__(self) self.__characteristic = "Wolves hunt in packs and have a leader" def get_characteristic(self): return super().get_characteristic() + "\n" + self.__characteristic class FlightBird(Bird): def __init__(self): Bird.__init__(self) self.__characteristic = "Flight birds fly and hunt for food" def look(self): return super().look() + "\n" + self.get_characteristic() def get_characteristic(self): return self.__characteristic class Eagle(FlightBird): def __init__(self): FlightBird.__init__(self) self.__characteristic = "Eagles fly extremely high and can see their prey from high up in the sky" def get_characteristic(self): return super().get_characteristic() + "\n" + self.__characteristic class Zoo: def __init__(self): self.__animal_list = list() self.__bird_list = list() def add(self, living_thing): if isinstance(living_thing, Animal): if len(self.__animal_list) < 2: self.__animal_list.append(living_thing) print("Animal Added") else: print("Zoo full for animals") elif isinstance(living_thing, Bird): if len(self.__bird_list) < 1: self.__bird_list.append(living_thing) print("Bird Added") else: print("Zoo full for birds") def looking(self): if len(self.__bird_list) == 0 and len(self.__animal_list) == 0: print("Zoo empty") for animal in self.__animal_list: print(animal.look()) print("") for bird in self.__bird_list: print(bird.look()) print("") def valid_animal: zoo = Zoo() zoo.add(Tiger()) zoo.add(Wolf()) zoo.add(WildCat()) zoo.add(Eagle()) zoo.looking()