Exam Solution#2
Conversation
| new_tasks = ['task_001', 'task_011', 'task_007', 'task_015', 'task_005'] | ||
| completed_tasks = ['task_002', 'task_012', 'task_006'] | ||
|
|
||
| completed_tasks.append(new_tasks.pop(-1)) |
There was a problem hiding this comment.
Можно проще: completed_tasks.append(new_tasks.pop())
Так как pop() по умолчанию удаляет последний элемент
| super().__init__(test_case_id, name, step_description, expected_result) | ||
|
|
||
| def print_test_case_info(self): | ||
| print(f"ID тест-кейса: {self.test_case_id}" |
There was a problem hiding this comment.
Нужно исправить: Частично этот вывод уже описан в родительском классе, можно вызвать его оттуда, а не дублировать код
| class Comedy(Movie): | ||
|
|
||
| def add_movie(self,movie): | ||
| self.movies.append(movie) |
There was a problem hiding this comment.
Нужно исправить: Метод уже описан в классе-родителе. Тут должен быть его вызов через super() и дописан необходимый return Иначе теряется весь смысл наследования
| def get_points_for_place(place): | ||
| if place > 100: | ||
| print("Баллы начисляются только первым 100 участникам") | ||
| return 0 |
There was a problem hiding this comment.
логичнее возвращать points зачем то же мы им дали дефолтное значение
| class TotalPoints(PointsForPlace, PointsForMeters): | ||
| @staticmethod | ||
| def get_total_points(meters,place): | ||
| total = PointsForPlace.get_points_for_place(place) + PointsForMeters.get_points_for_meters(meters) |
There was a problem hiding this comment.
Нужно исправить: get_points_for_place и .get_points_for_meters теперь методы TotalPoints после наследования, обращение к ним ведется через self
| return f"Хоккейных поражений: {self.losses}" | ||
|
|
||
| def total_points(self): | ||
| points = 2 * self.victories + self.draws |
There was a problem hiding this comment.
отлично: корректная работа с экземплярами класса, все расчёты верные
No description provided.