-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.py
More file actions
53 lines (33 loc) · 1.03 KB
/
2.py
File metadata and controls
53 lines (33 loc) · 1.03 KB
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
50
51
52
53
from abc import abstractmethod
class Clothes():
def __init__(self, name, param):
self.name = name
self.param = param
def __str__(self):
return f'{self.name} size {self.param}'
@abstractmethod
def rate_textile(self):
self.all_textile = 2*self.param + 0.3
return self.all_textile
def __add__(self, Clothes):
return self.all_textile + Clothes.all_textile
class Coat(Clothes):
# def __init__(self, name, param):
# super().__init__(f' zzzz {name}', param)
# Clothes.name = f' zzzz {name}'
# Clothes.param = param
@property
def rate_textile(self):
self.all_textile = self.param/6.5 + 0.5
return self.all_textile
class Suit(Clothes):
@property
def rate_textile(self):
self.all_textile = 2*self.param + 0.3
return self.all_textile
co = Coat('пальто', 44)
su = Suit('костюм', 42)
print(co.rate_textile) # test property
print(su.rate_textile) # test property
all = co + su
print(all)