Hello,
I can’t do the exercise No. 7, could you help me? I would appreciate if you could not only show me the correct code but also give me an explanation. For that purpose I will ask several more things below that concerns the exercise:
Add an .add_grade()
method to Student
that takes a parameter, grade
.
How and where should I add this .add_grade( ) method? Why is it called a method, shouldn’t a method be something that is like built-in? Not knowing what to do, I just wrote literally .add_grade(grade) in a new line and of course it gave me a syntax error.
.add_grade()
should verify that grade
is of type Grade
and if so, add it to the Student
‘s .grades
.
So if grade is of type Grade (written in code of course), I should add it to Student’s .grades. What exactly here are Student’s grades? self.grades?
If grade
isn’t an instance of Grade
then .add_grade()
should do nothing.
How do we actually do this ‘‘should no nothing’’?
Thank you very much.