-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocp.py
39 lines (28 loc) · 1.18 KB
/
ocp.py
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
class Notification:
def __init__(self, name):
self.name = name
self._format = 'Dear \033[95m {}\033[0m inform you about \033[94m{}\033[0m'
def print_notification(self, message: str):
print(self._format.format(self.name, message))
class StudentNotification(Notification):
def __init__(self, name):
super().__init__(name)
self.name = name
self._format = 'Dear \033[92m {}\033[0m inform you about \033[93m{}\033[0m'
class TeacherNotification(Notification):
def __init__(self, name):
super().__init__(name)
self.name = name
self._format = 'Dear \033[91m {}\033[0m inform you about \033[94m{}\033[0m'
class GroupNotification(Notification):
def __init__(self, name):
super().__init__(name)
self.name = name
self._format = 'Dear \033[96m {}\033[0m inform you about \033[92m{}\033[0m'
# test
student = StudentNotification('Test_student')
teacher = TeacherNotification('Test_teacher')
group = GroupNotification('Test_group')
student.print_notification('test_message for student')
teacher.print_notification('test_message for teacher')
group.print_notification('test_message for group')