-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.py
29 lines (24 loc) · 924 Bytes
/
Student.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
from Human import Human
from Classroom import Classroom
class Student(Human):
_class: Classroom
def __init__(self, name, last_name, group=None):
#print("init STUDENT")
super().__init__(name, last_name)
if group is not None:
self.set_class(group)
else:
self._class = None
def set_class(self, group):
if isinstance(group, Classroom):
self._class = group
else:
Exception("Класс ученика задан не верно")
def get_class(self):
if self._class is not None:
return self._class
else:
print("У ученика не задан класс")
#Exception("У ученика не задан класс")
def __repr__(self):
return f"Ученик (Имя = '{self.name}', Фамилия = '{self.last_name}')"