-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1018.py
More file actions
59 lines (34 loc) · 683 Bytes
/
1018.py
File metadata and controls
59 lines (34 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class Student(object):
@property
def birth(self):
return self._birth
@birth.setter
def birth(self,value):
self._birth = value
@property
def age(self):
return 2015 - self.birth
s = Student()
s.birth = 1981
print s.age
class Screen(object):
@property
def width(self):
return self._width
@width.setter
def width(self,value):
self._width = value
@property
def height(self):
return self._height
@height.setter
def height(self,value):
self._height = value
@property
def resolution(self):
self._resolution = self._width * self._height
return self._resolution
s = Screen()
s.width = 1024
s.height = 768
print (s.resolution)