Which of the following decorators is used to define a setter method for a property in Python?
- @getter
- @property
- @setter
- @setter and @getter
The @property decorator is used to define a getter method for a property. To define a setter, you would use @.setter.
Loading...
Related Quiz
- Which Python module would you use for logging error and debugging messages?
- What is the primary distinguishing feature of elements in a Python set?
- How do you define a floating-point variable in Python?
- What is the primary difference between a class attribute and an instance attribute in Python?
- A program is intended to print all even numbers between 1 to 10 but instead, it prints all numbers between 1 to 10. What control structure might be missing or misused?