FAQ: Learn Python: Classes - Review


This community-built FAQ covers the “Review” exercise from the lesson “Learn Python: Classes”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science

FAQs on the exercise Review

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


Did anyone try the the bonus practice in the review?

I seem to be having a challenge with the including the get_average() method.

One thing I observed was that the .grades was printing out in string representation form and when I included repr in an attempt to debug it, I got a ‘NoneType’ error traceback. Here is code below: (can anyone spot the error?)

class Student(object):
attendance = {}
def init(self, name, year):
self.name = name
self.year = year
self.grades = list()

def repr(self):
print(self.name, self.year, self.grades)

def add_grade(self, grade):
if type(grade) == Grade:

roger = Student(“Roger van der Weyden”, 10)
sandro = Student(“Sandro Botticelli”, 12)
pieter = Student(“Pieter Bruegel the Elder”, 8)

class Grade:
minimum_passing = 65
def init(self, score):
self.score = score
def is_passing(self):
if self.score > self.minimum_passing:
return “Yes”
return “No”

value = Grade(100)



One thing that you did wrong is writing init keyword without underscores before and after it. So it should be like this to work: __init__.


I have the same question, did anybody figure it out


I just figured you need to add the repr() method in your grade class to print out the list of grades without just showing the memory location

class Grade:
minimum_passing = 65

def init(self, score):
self.score = score
def repr(self):
return str(self.score)


Hey thanks.

I did a copy and paste but that didnt work…I have it in dunder in the actual code


Hey thanks. That worked.

But I’m still stuck on why my get_average does not work.

Did you by chance use a for loop?

def get_average(self):
total = 0
for grade in self.grades:
total += grade
return total

I get unsupported type error.


In case you struggled with this as well. I just made Grade a subclass of ‘int’ and it seemed to recognize this.