Discuss / Python / 打个卡

打个卡

Topic source

vv阿甘vv

#1 Created at ... [Delete] [Delete and Lock User]
class Screen(object):
    @property
    def width(self):
        return self._width
    @width.setter
    def width(self, wid):
        self._width = wid
    @property
    def height(self):
        return self._height
    @height.setter
    def height(self, hei):
        self._height = hei
    @property
    def resolution(self):
        return self._width * self._height

s = Screen()
s.width = 1024
s.height = 768
print('resolution =', s.resolution)
if s.resolution == 786432:
    print('测试通过!')
else:
    print('测试失败!')

  • 1

Reply