Coding task · Python course · Module 3: Object-Oriented Programming

Property Getter

Create a getter with @property

Task

Create an Animal(name, age) class with an age property (@property getter) that returns the age stored in self._age. If __init__ gets age < 0, raise ValueError