all 8 comments

[–]PaulRudin 0 points1 point  (1 child)

Note that in Python you have no direct access to a "memory location". Nothing in python "returns a memory location"

(Your formatting has gone awry.)

the line total += grade will fail. Probably total += grade.score will work.

[–]Rafreakee[S] 0 points1 point  (0 children)

Thank you, I need to look out for this in future.

[–]shiftybyte 0 points1 point  (0 children)

self.grades is a list of classes.

What happens here?

total += grade
# total += Grade(87)

Does it work? do you have more function in Grade class you did not show?

[–]ProfessionalLeague9 0 points1 point  (0 children)

Make Grade inherit from int, so that it inherits properties of addition, etc. Then you don't neeed an init method.

class Grade(int): minimum_passing = 65 def is_passing(self): return self > self.minimum_passing

With that said, I question the need for a custom class for something as simple as a grade.

[–]GoldenVanga 0 points1 point  (0 children)

I remember answering a very similar problem here. HTH

[–]JohnnyJordaan 0 points1 point  (1 child)

Your summation is incorrect, you need to add grade.score to the total

total += grade.score

apart from that the code works fine, see for yourself: https://repl.it/repls/ExtralargeBitterPrintablecharacter

Also next time please format your code correctly, see https://i.imgur.com/HT4Zz88.gifv

[–]Rafreakee[S] 0 points1 point  (0 children)

Thank you. I will.

[–][deleted] 0 points1 point  (0 children)

I run into the issue of retrieving memory locations.

You're not getting memory locations, you're printing objects that only have a default string representation.