Python Object Methods
Objects can also contain methods. Methods in objects are functions that belong to the object.
Let us create a method in the Person class:
Insert a function that prints a greeting, and execute it on the p1 object:
def __init__(self, name, age):
self.name = name
self.age = age
print("Hello my name is " + self.name)
p1 = Person("John", 36)
is a reference to the current instance of the class, and is used to access variables that belong to the class.