0

classes

class Student: def __init__(self, name): self.name = name def greet(): print(self.name+" says hi") obj = Student("John") obj.greet(self) class Student: def __init__(self, name): self.name = name def greet(): print(self.name+" says hi") obj = Student("John") obj.greet(self) can anybody help me out there...?

4th Jul 2021, 3:24 PM
Lokendra Gupta
Lokendra Gupta - avatar
2 Respuestas
+ 2
give self parameter in the greet method : i.e. ---> def greet(self)
4th Jul 2021, 3:34 PM
Jitendra
Jitendra - avatar