How can I resolve Type Error

I don’t know why I have a TypeError here. I followed my instructor’s code, he successfully got the answer, but I can’t. Does anyone help?

class ClassName:
pass
instance= ClassName()
class Students:
def init(self,name,age,grade):
self.name= name
self.age= age
self.grade= grade

student1= Students(“Bob”,12,“7th”)
student1.name

The code would work correctly if indented properly. Do a web search for
“Python indentation”, maybe.

After indenting the code, I get this output:

Bob

Thank you for your reply. I did web search and still would not be able to understand that why it shows type error. Could you please share with me that how you got the output.

class ClassName:
pass

instance= ClassName()
class Students:
def init(self,name,age,grade):
self.name = name
self.age = age
self.grade = grade

student1 = Students(“Bob”,12,“7th”)
student1.name

Thanks

Just re-indenting your code and wrapping the last statement in a print():

class ClassName:
pass instance= ClassName()

class Students:
def init(self, name, age, grade):
self.name = name
self.age = age
self.grade = grade

student1 = Students(“Bob”, 12, “7th”)
print(student1.name)

I am guessing that your “init” method has been written with only one underscore character on each side; something like _init_. If that is the case, note that it needs two underscore characters on each side: __init__.

André Roberge