Python Object-Oriented Python Instant Objects Method Interactivity

Mark Nembhard
Mark Nembhard
1,385 Points

not much feedback on this one but please help on the if else steps to this quizz

I seem to have made an error in logic somewhere on this as i want to be able to choose one path if a value is over 50 or another if it is equal or below. All this using class and methods

first_class.py
class Student:

    name = "Mark"
    def feedback(self,grade):
        grade= 51
        if self.grade > 50:
             praise(self)
        else reassrance(self)


    def praise(self):
        return "You inspire me, {}".format(self.name)


    def reassurance(self):
        return "Chin up, {}. You'll get it next time!".format(self.name)

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there, Mark Nembhard ! There are a few things going on here.

  • First, add the code for your new method to the bottom of the file.
  • The feedback method takes a grade argument at the time it is called/executed. The class itself has no grade attribute so there is no such thing as self.grade here.
  • The else must be terminated with a colon and the following line indented under it.
  • You should be calling self.praise() and self.reassurance() without passing anything in
  • You are meant to return the strings produced by the praise and reassurance methods.
  • You have a typo in "reassurance" in your feedback method

Some pseudocode:

def feedback(self,grade):
       if grade > 50:
           #  return the string produced by the praise method called on self
        else: 
           # return the string produced by the reassurance method called on self

Hope this helps! :sparkles: