I am learning about classes and objects in Python, but when I run this code the output is an error. Can anyone show me how to fix it?
class Person :
def _init_ (self,name,age) :
self.name = name
self.age = age
def myfunction(self) :
print("Hello My Name Is" + self.name)
p1 = Person("John",36)
p1.myfunction()
Here's the error output:
Traceback (most recent call last): File "F:\IPB\PENUGASAN\SEMESTER 2\STRAKDAT\Penugasan\Pertemuan 3\Materi 3.py", line 16, in p1 = Person("John",36) TypeError: Person() takes no arguments
------------------ (program exited with code: 1)
Press any key to continue . . . Terminate batch job (Y/N)?