-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.ocp.py
More file actions
63 lines (41 loc) · 1002 Bytes
/
2.ocp.py
File metadata and controls
63 lines (41 loc) · 1002 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
50
51
52
53
54
55
56
57
58
59
60
61
62
from abc import ABC
class Animal(ABC):
@abstractmethod
def make_sound(self):
pass
class Lion(Animal):
def make_sound(self):
print("ROAR")
class Mouse(Animal):
def make_sound(self):
print("I want cheese")
animals = [
Lion(),
Mouse()
]
def animal_sound(animals: list):
for animal in animals:
animal.make_sound()
animal_sound(animals)
class DescontoCliente:
def __init__(self, price):
self.__price = price
@property
def price(self):
return self.__price
@price.setter
def price(self, price):
self.__price = price
@abstractmethod
def give_discount(self):
pass
class DescontoFavorito:
def __init__(self, price):
super().__init__(price)
def give_discount(self):
return self.prcie * 0.2
class DescontoVip:
def __init__(self, price):
super().__init__(price)
def give_discount(self):
return self.prcie * 0.4