1 00:00:00,270 --> 00:00:09,980 In this tutorial we will talk about nested lists an element in a list can be any sort of object but 2 00:00:09,990 --> 00:00:22,080 say for example integer float strings and also another list so a list can contain sublets which in turn 3 00:00:22,080 --> 00:00:27,320 can contain sublease themselves and so on to arbitrary date. 4 00:00:28,080 --> 00:00:38,940 So consider this list list one and one of the elements in this list is another list also called a nested 5 00:00:38,940 --> 00:00:48,200 list are a sub list and the sub list in a list that is a sub list in a parent list. 6 00:00:48,240 --> 00:00:51,720 Count as one single element in the list. 7 00:00:52,530 --> 00:00:58,770 So the index for this sub list is 2 3. 8 00:00:59,950 --> 00:01:00,520 And 4. 9 00:01:00,580 --> 00:01:04,270 So the index for the sub list is 3. 10 00:01:04,360 --> 00:01:11,850 So if we want to access the elements in a sub list that is 7 8 or 9. 11 00:01:11,890 --> 00:01:18,940 In that case we need to add an additional index when indexing these sub list. 12 00:01:19,180 --> 00:01:28,160 So we need to give two indexes defrost index is to access these sub list within the parent list. 13 00:01:28,540 --> 00:01:38,590 So index is three say for example within this sub list I want to access the second element in the sub 14 00:01:38,590 --> 00:01:45,680 list which is at the second position on has the first index 1. 15 00:01:45,790 --> 00:01:51,760 So this is going to get a 3 number 8 in the sub list. 16 00:01:51,970 --> 00:01:54,080 So we're in the Jupiter note book. 17 00:01:54,160 --> 00:02:02,840 I have defined a list list one which includes a sub list as one of the elements. 18 00:02:02,980 --> 00:02:17,810 So in order to access element in the sub list the index should be list 1 the sub list is it index 3 19 00:02:18,080 --> 00:02:23,860 and the element 8 within the sub list is that index 1. 20 00:02:23,930 --> 00:02:27,790 So this is going to retrieve number 8 from the sub list. 21 00:02:27,800 --> 00:02:41,030 Here is another example of sublease the list a list to has a sub list at index 2 and these sub list 22 00:02:41,030 --> 00:02:48,160 contained another sub list as you can see here and it contains the element E F and G. 23 00:02:48,170 --> 00:02:55,610 So let's try to access this sub list for list using two indices. 24 00:02:55,760 --> 00:03:09,010 The first sub list within list 2 is at index 2 and then the sub list within the sub list is at index 25 00:03:09,010 --> 00:03:10,210 2 as well. 26 00:03:10,450 --> 00:03:17,920 So we have retrieved these are blessed that contains the element E F and G. 27 00:03:17,920 --> 00:03:26,190 Now if you want to access any of these elements then you need to add an additional index. 28 00:03:26,410 --> 00:03:33,280 And finally if I want to access the element at 0 at index. 29 00:03:33,280 --> 00:03:37,750 So this is how we can access elements in sublease.