以下程序运行结果是?classTest:def()get(self):()returnself.()valuedef()set(self,v):()ifv=0andv=100:;设置了可赋值的范围()
13 查阅
以下程序运行结果是?classTest:def()get(self):()returnself.()valuedef()set(self,v):()ifv=0andv=100:;设置了可赋值的范围()self.()value=v()else:()print(v,'赋值错误,因为不在此范围:0~100')()value=property(()get,()set);可读可写属性defshow(self):()print(self.()value)()t=Test()t.value=30t.value=101t.show()()
A.101赋值错误,因为不在此范围:0~100
30
B.30101赋值错误,因为不在此范围:0~100
C.程序执行出现异常
D.101
参考答案:
30