Everything in Python is an object and an object is an entity that contains data or attributes and associated
methods or functions.
So in Python instances attribute functions methods classes variables arguments that be passed to functions
in the function called at all different objects.
Let us consider the real world example.
Say we are constructing a house which is an object and the House object is made up of rooms which are
also objects.
The room object is made up of walls ceilings etc. And these are also the walls and ceilings that also
objects.
The what this object the wall object is made up of bricks cement etc. So every object is constructed
from a more primitive object coming back to Python.
We have just discussed that objects are entities that have attributes and functions and everything in
Python is an object.
We have classes attributes methods functions arguments that be passed to functions at all objects and
each object is constructed or built from a more primitive object.
So for example the class object has attribute and functions as primitive objects.
And from this class object after we define a class object we can create instances which again object
of the class object.
The class is a blueprint or gives us structure on how an object has to be constructed or built and we
have been actually working with a lot of built in classes in all of our previous tutorials.
Consider the number two and this number is an object in Python and this object is an instance of the
built in class integer and all the attributes that are defined in the integer class are applicable to
the value to here and all the methods the different method defined in the integer class can be applied
on this value to devalue to what the object to has a type.
It has an I.D. which means it is stored in a memory address and then it has a value.
Similarly when we define a string.
Say for example A is hello.
Now a is an instance or a copy all these during class and all of the attributes and the different methods
defined the built in string class are applicable art can be applied on the string your and this is a
variable which is like pointing to a memory address containing this value.
Hello So this object a has a type and the type is a string and then it has it is stored in a memory
so it has an identity and the value that it is pointing to is destroying Hello.
Similarly when we define a list this list list one is an instance of the list class and we can apply
different methods on the list class which are define the various methods defined in the List class on
this list object and the list object has a type which is the list and then it has an identity I.D..
And this is due value that it is pointing to build types includes strings.
Float list function module and so on we can do a lot with these building types but we can do a lot more
if we learn to combine them to create custom types of object which are tailored to our application so
here we have a class card and these are the attributes and then we have a method defined in this class.
Next we have created an instance of this class card C V and this instance is an object in Python so
this has a type this object C V has a type.
It has an identity it is stored in a memory address and it has a value.
So let's see this in the Jupiter notebook.
We have defined a variable X which is pointing to the value to the value to is actually an instance
of the integer plus the built in class integer.
Now when we check the type all the variable x so the type is integer.
It has an identity.
So it is stored in this particular memory address the value that it is pointing to is to let us now
define another variable E which bind to the string hello.
So a is a variable which but just pointing to a memory address containing this string Hello.
When you check the type or the variable e it is of the type.
String so it is an instance of the built in class string and it is also stored in a memory address we
can apply the various methods that are defined in the String class on this variable e.
Let us call the method upward on this string Antony's strings are immutable when we call this method
on the variable it is going to create a new string rather than changing the string.
So when you display this string e it is still pointing to the old string Hello similarly we have created
an instance of the class God but just see beat which is an object.
This object has a type and the type of the object of the instance C R B is Dick called so it has been
created using the class called and it is stored in a memory address so it has an I.D. and these different
methods that are defined in the class card can be applied on this instance.
C R B.