demo_class4.py:
class Person: def __init__(self, name, age): self.name = name self.age = age def myfunc(self): print("Hello my name is " + self.name) p1 = Person("John", 36) p1.myfunc()
➜ begtut>python demo_class4.py
Hello my name is John