Question OOP-ENC-0038
EasyWhat is the output of this code?
class T:
def __init__(self):
self._c = 0
@property
def c(self):
return self._c
@c.setter
def c(self, v):
if v >= 0:
self._c = v
t = T()
t.c = 5
t.c = -2
print(t.c)
- A.
-2
- B.
5
- C.
Sign up free to see the answer and a step-by-step explanation.