1 00:00:02,990 --> 00:00:15,980 Everything in Python is an object and an object is an entity that contains data or attributes and associated 2 00:00:16,310 --> 00:00:18,740 methods or functions. 3 00:00:18,800 --> 00:00:34,940 So in Python instances attribute functions methods classes variables arguments that be passed to functions 4 00:00:35,540 --> 00:00:41,200 in the function called at all different objects. 5 00:00:41,430 --> 00:00:44,250 Let us consider the real world example. 6 00:00:44,340 --> 00:00:54,620 Say we are constructing a house which is an object and the House object is made up of rooms which are 7 00:00:54,810 --> 00:00:57,400 also objects. 8 00:00:57,510 --> 00:01:07,530 The room object is made up of walls ceilings etc. And these are also the walls and ceilings that also 9 00:01:07,620 --> 00:01:08,450 objects. 10 00:01:08,490 --> 00:01:21,360 The what this object the wall object is made up of bricks cement etc. So every object is constructed 11 00:01:21,600 --> 00:01:26,500 from a more primitive object coming back to Python. 12 00:01:26,520 --> 00:01:34,050 We have just discussed that objects are entities that have attributes and functions and everything in 13 00:01:34,050 --> 00:01:36,360 Python is an object. 14 00:01:36,360 --> 00:01:45,360 We have classes attributes methods functions arguments that be passed to functions at all objects and 15 00:01:45,420 --> 00:01:51,810 each object is constructed or built from a more primitive object. 16 00:01:51,810 --> 00:02:01,000 So for example the class object has attribute and functions as primitive objects. 17 00:02:01,050 --> 00:02:12,960 And from this class object after we define a class object we can create instances which again object 18 00:02:13,320 --> 00:02:15,600 of the class object. 19 00:02:15,600 --> 00:02:26,160 The class is a blueprint or gives us structure on how an object has to be constructed or built and we 20 00:02:26,160 --> 00:02:33,740 have been actually working with a lot of built in classes in all of our previous tutorials. 21 00:02:33,750 --> 00:02:47,450 Consider the number two and this number is an object in Python and this object is an instance of the 22 00:02:47,450 --> 00:02:58,850 built in class integer and all the attributes that are defined in the integer class are applicable to 23 00:02:58,850 --> 00:03:09,820 the value to here and all the methods the different method defined in the integer class can be applied 24 00:03:09,880 --> 00:03:16,930 on this value to devalue to what the object to has a type. 25 00:03:17,230 --> 00:03:25,060 It has an I.D. which means it is stored in a memory address and then it has a value. 26 00:03:25,180 --> 00:03:28,920 Similarly when we define a string. 27 00:03:29,200 --> 00:03:34,690 Say for example A is hello. 28 00:03:36,450 --> 00:03:48,270 Now a is an instance or a copy all these during class and all of the attributes and the different methods 29 00:03:48,300 --> 00:03:58,840 defined the built in string class are applicable art can be applied on the string your and this is a 30 00:03:58,840 --> 00:04:04,270 variable which is like pointing to a memory address containing this value. 31 00:04:04,390 --> 00:04:15,960 Hello So this object a has a type and the type is a string and then it has it is stored in a memory 32 00:04:15,960 --> 00:04:22,790 so it has an identity and the value that it is pointing to is destroying Hello. 33 00:04:23,520 --> 00:04:36,060 Similarly when we define a list this list list one is an instance of the list class and we can apply 34 00:04:36,060 --> 00:04:43,080 different methods on the list class which are define the various methods defined in the List class on 35 00:04:43,080 --> 00:04:53,380 this list object and the list object has a type which is the list and then it has an identity I.D.. 36 00:04:53,610 --> 00:05:00,810 And this is due value that it is pointing to build types includes strings. 37 00:05:00,830 --> 00:05:11,010 Float list function module and so on we can do a lot with these building types but we can do a lot more 38 00:05:11,280 --> 00:05:20,160 if we learn to combine them to create custom types of object which are tailored to our application so 39 00:05:20,160 --> 00:05:30,470 here we have a class card and these are the attributes and then we have a method defined in this class. 40 00:05:30,510 --> 00:05:41,520 Next we have created an instance of this class card C V and this instance is an object in Python so 41 00:05:41,550 --> 00:05:46,890 this has a type this object C V has a type. 42 00:05:46,890 --> 00:05:54,270 It has an identity it is stored in a memory address and it has a value. 43 00:05:54,840 --> 00:05:57,530 So let's see this in the Jupiter notebook. 44 00:05:57,600 --> 00:06:07,530 We have defined a variable X which is pointing to the value to the value to is actually an instance 45 00:06:07,860 --> 00:06:15,800 of the integer plus the built in class integer. 46 00:06:15,810 --> 00:06:25,400 Now when we check the type all the variable x so the type is integer. 47 00:06:25,810 --> 00:06:27,910 It has an identity. 48 00:06:27,910 --> 00:06:36,550 So it is stored in this particular memory address the value that it is pointing to is to let us now 49 00:06:36,550 --> 00:06:41,290 define another variable E which bind to the string hello. 50 00:06:41,770 --> 00:06:49,930 So a is a variable which but just pointing to a memory address containing this string Hello. 51 00:06:50,200 --> 00:06:56,020 When you check the type or the variable e it is of the type. 52 00:06:56,020 --> 00:07:09,250 String so it is an instance of the built in class string and it is also stored in a memory address we 53 00:07:09,270 --> 00:07:16,770 can apply the various methods that are defined in the String class on this variable e. 54 00:07:17,530 --> 00:07:30,010 Let us call the method upward on this string Antony's strings are immutable when we call this method 55 00:07:30,040 --> 00:07:36,550 on the variable it is going to create a new string rather than changing the string. 56 00:07:36,790 --> 00:07:47,040 So when you display this string e it is still pointing to the old string Hello similarly we have created 57 00:07:47,100 --> 00:07:55,210 an instance of the class God but just see beat which is an object. 58 00:07:55,230 --> 00:08:07,060 This object has a type and the type of the object of the instance C R B is Dick called so it has been 59 00:08:07,060 --> 00:08:20,170 created using the class called and it is stored in a memory address so it has an I.D. and these different 60 00:08:20,170 --> 00:08:26,410 methods that are defined in the class card can be applied on this instance. 61 00:08:26,470 --> 00:08:27,220 C R B.