1class Person:
2 def __init__(self, name, age):
3 self.name = name
4 self.age = age
5
6p1 = Person("John", 36) // Object definition
7
8print(p1.name)
9print(p1.age)
1# If you are familiar with C++ or Java think of the __init__ method as a constructor.
2# It is the method that is being called when the class is called.In the following
3# example we will see how we can call the __init__ method
4
5my_variable = MyClass()