1 00:00:05,980 --> 00:00:06,610 Hey everyone. 2 00:00:07,630 --> 00:00:11,710 So in this video we are going to learn and indexing and slicing in to the edit. 3 00:00:12,100 --> 00:00:17,250 So for that that just create that DNA by using a.. 4 00:00:17,430 --> 00:00:18,130 At Ange 5 00:00:21,270 --> 00:00:26,970 and at least don't let me have all 50 elements this time. 6 00:00:26,970 --> 00:00:32,540 And then we use data in shape to define the order that is five. 7 00:00:32,550 --> 00:00:34,250 Gross. 8 00:00:34,350 --> 00:00:36,550 Or just use 25 elements. 9 00:00:36,570 --> 00:00:39,300 There's also enough for demonstration. 10 00:00:40,110 --> 00:00:44,200 So here we have this one and index. 11 00:00:44,220 --> 00:00:48,300 Here we have now to excessively element in this one. 12 00:00:48,360 --> 00:00:54,700 We have two different methods that is first one is something like the list that is positive Austell 13 00:00:54,790 --> 00:00:56,030 event 2. 14 00:00:56,190 --> 00:01:01,330 And then he had three that first one is denoting the row that's I. 15 00:01:01,500 --> 00:01:03,350 And this one is G. 16 00:01:03,420 --> 00:01:11,060 So if you want to access this do it then how you can access this one is first in DRO 0 1 and 2. 17 00:01:11,220 --> 00:01:15,930 So the row will be 2 and the column will be 0 1 and 2. 18 00:01:15,960 --> 00:01:29,580 There is also a shift center you get detoured if you want to access 22 then it will be fourth row. 19 00:01:29,660 --> 00:01:31,070 And second element. 20 00:01:32,090 --> 00:01:33,520 So the second column. 21 00:01:33,710 --> 00:01:38,090 So that's what we can use the indexing to the array. 22 00:01:38,090 --> 00:01:47,370 You can also use something like X and dispenses this one is in Python 3 Lightfoot for us to do we have 23 00:01:47,580 --> 00:01:51,120 the added that may not be happened here. 24 00:01:51,160 --> 00:02:04,090 But so this one is this just shift into so there is no different is that the package there. 25 00:02:04,120 --> 00:02:06,250 I got a little confused in that. 26 00:02:06,550 --> 00:02:07,820 So sorry for that. 27 00:02:07,820 --> 00:02:09,320 Here we have this one. 28 00:02:09,650 --> 00:02:10,940 You can do the same. 29 00:02:10,940 --> 00:02:21,890 The D like food comma to shift into you go to 22 that's about the indexing and now what about the slicing. 30 00:02:21,890 --> 00:02:30,830 What if you need to slice like here These 2 3 4 and 7 8 9. 31 00:02:30,890 --> 00:02:32,600 So how you can slice it. 32 00:02:32,840 --> 00:02:41,750 So in this just like that one they used something like one and then this thing up to date that we used 33 00:02:41,750 --> 00:02:46,890 the same thing but for 2D and for that we use that word twice. 34 00:02:46,910 --> 00:02:47,570 Just like that. 35 00:02:47,930 --> 00:02:51,870 So if we need to have this spot. 36 00:02:52,190 --> 00:02:56,500 So first we define that which tools we need. 37 00:02:56,510 --> 00:03:01,630 So we need the draw from that is zero for this one and this one is 1. 38 00:03:02,120 --> 00:03:12,560 So we need 0 to 2 because the upper limit is not included then V you lead the columns that is this column 39 00:03:12,680 --> 00:03:13,690 this column this. 40 00:03:13,910 --> 00:03:16,580 So this is second third and fourth. 41 00:03:16,580 --> 00:03:21,020 So we use after 2 all the columns. 42 00:03:21,020 --> 00:03:27,360 So here he can shift into here we get 2 3 4 and 7 8 9. 43 00:03:27,470 --> 00:03:30,590 You can do same thing with any element here. 44 00:03:30,590 --> 00:03:38,630 Like if I need to have this one this one and this the square matrix of six to 18 we will do something 45 00:03:38,630 --> 00:03:39,360 like. 46 00:03:39,410 --> 00:03:40,790 Let me clear this one here. 47 00:03:43,500 --> 00:03:53,330 This will also no to have this one the row I need is that is first second and third. 48 00:03:53,570 --> 00:03:59,860 So I will go for first two four equals upper limit is excluded. 49 00:04:00,320 --> 00:04:08,460 Then I will use the column that is again same first two fourth shift until you get these elements. 50 00:04:08,480 --> 00:04:13,450 That is six seven eight eleven twelve thirteen and 16 17 18. 51 00:04:13,460 --> 00:04:18,470 Next how you can slice any list in number by my using this thing. 52 00:04:18,470 --> 00:04:26,460 One more thing that I want to teach you here is something like that is known as conditional selection. 53 00:04:26,870 --> 00:04:32,780 That is if we have let we have another one here. 54 00:04:33,200 --> 00:04:43,110 That is something like and B don't arrange and from 1 to 1. 55 00:04:43,340 --> 00:04:54,170 Here we have VI this one if you want to have something like all the values greater than just like here 56 00:04:54,170 --> 00:05:02,540 we have well so greater than 20 then you do this thing you will get a list of billions in which all 57 00:05:02,540 --> 00:05:08,780 the values lower than that one will be false and higher than that one will be true. 58 00:05:09,050 --> 00:05:15,750 And if you need the values there because this one true false issuing the indexes we just use again a 59 00:05:15,750 --> 00:05:22,040 value here and this one in these brackets then you will get all the values. 60 00:05:22,400 --> 00:05:25,490 So this thing is known as the conditional selection. 61 00:05:25,490 --> 00:05:28,160 You can have any kind of this one here. 62 00:05:28,250 --> 00:05:33,930 You can also have like less than divisible just by using the remainder. 63 00:05:34,010 --> 00:05:44,840 Like if I show you something like the values that have like Y then I use the reminder operator like 64 00:05:44,850 --> 00:05:50,990 the US in this data and is equal to zero. 65 00:05:51,150 --> 00:05:57,200 I think that may invoke and this one needs an equal to be done maybe. 66 00:05:57,200 --> 00:06:08,740 So I don't know what is required for the reminder and if we work for less then like four we have one 67 00:06:08,740 --> 00:06:18,120 two three four reminder we need something like reminder of that we do is not equal to zero. 68 00:06:18,730 --> 00:06:24,960 Maybe I have divided that one with zero that's why it's not working. 69 00:06:24,970 --> 00:06:32,060 So here we have this one there I have done zero because zero division is not possible. 70 00:06:32,440 --> 00:06:34,570 So this is about this one here. 71 00:06:34,600 --> 00:06:42,670 Condition selection this one is not used much in any case I have not even used that thing anywhere till 72 00:06:42,670 --> 00:06:50,650 now just the operators and operation just have to solve any problem but still there is something you 73 00:06:50,650 --> 00:06:51,180 need to know. 74 00:06:51,190 --> 00:06:52,540 That's why I had to do that. 75 00:06:53,110 --> 00:06:55,800 So thanks for watching and we will continue in the next video.