When printing an object should reveal useful state, define __repr__ to return a developer-oriented string, conventionally valid Python syntax. Printing an object invokes this method when it is defined; __str__ can be added later when end-user output should differ. section 9.7
A shared implementation works well with inheritance. An Animal class can format species, color, and number_of_legs from self, while Wolf, Sheep, Snake, and Parrot inherit that behavior. Subclasses can pass color and a fixed leg count through super().__init__. section 9.27
Representing contained objects
A Cage can define __repr__ to include its ID and the animals it contains, so printing a cage exposes both the container and its contents. The exercise builds cages, adds animals with add_animals, and asks the representation to display them together. section 9.31
Use the class-hierarchy figure to see which representation and initialization methods belong on Animal and which belong on Wolf. section 9.27


