Python - Encapsulation and Data Protection
Which of the following is the correct syntax to define a setter for a property named value?
class MyClass:
@property
def value(self):
return self._value
# What goes here?Which of the following is the correct syntax to define a setter for a property named value?
class MyClass:
@property
def value(self):
return self._value
# What goes here?@value.setter and defines a method with the same name value.@value.setter and method value. Others use wrong decorator or method names.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions