Python Object-Oriented Python Instant Objects Your first method

30,205 Points

Why can't "Well done, {}".format(name) be used?

how do I do this question
class Student:
    name = "mari"

    def praise(self):
        return "Well done, {}".name

1 Answer

Using "Well done, {}".format(name) will give you a "name" error, while using it inside a class, outside a class, it should be fine.

since your making use of a class Student in that case, an instance should be referenced to name.

class Student:
    name = "Mari"

>>> student = Student() 👈 #Created an instance of class Student


self is an instance, if you need more clarification, hit me up again here.