if I have a class of students and I wanted a method that printed they were failing when their grade went below 60 how would I get it to show the name of the specific student rather than the object location, I’ve seen some stuff with the __str__ and __repr__ methods but cannot understand how they work in this case. Example
class Student: def grade(self, score) if score < 60 print(f”{self} is failing”)mark = Student()mark.grade(50)If there is a better way to go about doing this as well I would love to know as I’m still learning about python, I would like this to print “mark is failing” but right now it just prints to object location is failing
I would like it to print mark is failing from the previous example rather than object location is failing