Vidyalelo
Python · Q12

Decorators in Depth

Programming · Python · question 12

Q12

What is the purpose of the property decorator in Python?

A.
To add properties to classes
B.
To remove properties from classes
C.
To define a getter method for a class attribute
Answer
D.
To define a setter method for a class attribute

Answer: Option C

Solution

Answer: Option C
Solution:
The property decorator is used to define a getter method for a class attribute.