I just finished working my way through this exercise and am left with a couple of questions. Here is my (solution) code for reference:
class Student: def __init__(self, name, year): self.name = name self.year = year self.grades =  def add_grade(self, grade): if type(grade) == Grade: self.grades.append(grade) class Grade: minimum_passing = 65 def __init__(self, score): self.score = score roger = Student("Roger van der Weyden", 10) sandro = Student("Sandro Botticelli", 12) pieter = Student("Pieter Bruegel the Elder", 8) pieter.add_grade(Grade(100))
1. Just to make sure, `if type(grade) == Grade` is checking if an instance of `Grade` was used to pass into `grade`? And `type(grade)` returns `<class '__main__.Grade'>` because an instance of `Grade` was passed in? 2. Why does `pieter.add_grade(Grade(100))` append `<__main__.Grade object at 0x7f40fdbf5a20>` to `self.grades` and not `100`?