Implement a Student
, School
, and a City
classes like so:
name
attribute, given at initialization time.add_exam(grade)
method, recording a new grade for him,
as a float.add_student(student)
method.add_school(school)
method.get_mean()
method giving:get_best_student()
method, returning the best Student
.get_best_school()
and a get_best_student()
methods, returning respectively a School
and a Student
..paris = City('paris')
hkis = School('hkis')
paris.add_school(hkis)
for student_name, student_grades in (('alice', (1, 2, 3)),
('bob', (2, 3, 4)),
('catherine', (3, 4, 5)),
('daniel', (4, 5, 6))):
student = Student(student_name)
for grade in student_grades:
student.add_exam(grade)
hkis.add_student(student)
print(paris.get_best_school().name)
print(paris.get_best_student().name)
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts: