Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumPythonpropertySingle-choice MCQ

In a subclass you want to add a setter while keeping the parent's getter. What does this print?

class Base: @property def val(self): return 1 class Sub(Base): @Base.val.setter def val(self, v): self._v = v s = Sub() print(s.val)