Put in order · Python course · Module 3: Object-Oriented Programming

Encapsulation - Getter/Setter

Arrange the elements of the property pattern:

Items to put in order

  • @property (getter decorator)
  • self._age = age (protected attribute)
  • def age(self): return self._age
  • @age.setter (setter decorator)

You can check the correct answer by solving this task in the CodeWorlds game.