Class

class Student:
def init(self, name, year):
self.name = name
self.year = year
self.grades =

def add_grade(self, grade):
if type(grade) is 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))

#at the last line why we need to put Grade infront of 100

The Student.add_grade() method requires an argument that is of type Grade, i.e., that is a member of the class Grade. A simple int like 100 wont work.

You can do this in two ways:

grade = Grade(100)
pieter.add_grade(grade)

Or…

pieter.add_grade(Grade(100))
2 Likes