Python Objects and Classes задача Class
Здравейте,
тема Objects and Classes, задача Class:
https://softuni.bg/trainings/resources/officedocument/74651/objects-and-classes-exercise-programming-fundamentals-with-python-september-2022/3840
Judge ми дава 75, не мога да разбера защо:
class Class: __students_count = 22 def __init__(self, name): self.name = name self.students = [] self.grades = [] def add_student(self, name: str, grade: float): if Class.__students_count > len(self.students): self.students.append(name) self.grades.append(grade) def get_average_grade(self): average_grade = sum(self.grades) / len(self.students) return f"{average_grade:.2f}" def __repr__(self): return f"The students in {self.name}: {', '.join(self.students)}. Average grade: {self.get_average_grade()}"
Моля да споделите вашите решения.