1 00:00:07,830 --> 00:00:14,130 And then let's talk about some of the data structures that are very, very useful in Python, and you 2 00:00:14,130 --> 00:00:15,300 definitely need to know them. 3 00:00:15,660 --> 00:00:20,130 So the first one I want to cover is the list or the lists. 4 00:00:20,640 --> 00:00:24,360 So lists usually is just the list of items. 5 00:00:24,820 --> 00:00:27,180 It doesn't matter if they are numbers or strings. 6 00:00:27,180 --> 00:00:31,960 And so it is a good practice to have a similar types of items in your list. 7 00:00:31,970 --> 00:00:37,340 So let's create a list of famous or famous tech companies. 8 00:00:37,620 --> 00:00:40,830 So let's write a check list. 9 00:00:41,640 --> 00:00:49,890 And this will be equal to Brackett's, Apple, Microsoft, Samsung. 10 00:00:51,280 --> 00:00:53,680 Dell and HP. 11 00:00:54,160 --> 00:00:59,860 So let's see what we can do basically with this latest outage for some operations here. 12 00:01:00,220 --> 00:01:06,790 So first of all, I would like let's print some of the components inside this list, some of the elements. 13 00:01:07,150 --> 00:01:09,280 So let's write the print checklist. 14 00:01:09,700 --> 00:01:13,580 And then I would like to print the elements from zero until two. 15 00:01:14,290 --> 00:01:20,110 OK, so obviously zero is apple and trees here, but on some. 16 00:01:20,350 --> 00:01:25,030 But since we say until two, we print only the first two items. 17 00:01:25,030 --> 00:01:27,730 OK, zero one and we'll stop at two. 18 00:01:28,180 --> 00:01:29,460 This is how Python works. 19 00:01:29,470 --> 00:01:30,640 This is the logic behind it. 20 00:01:31,120 --> 00:01:35,560 So if I run the code, you will see that we print Apple and Microsoft. 21 00:01:35,770 --> 00:01:43,530 Now, you can also change the elements inside the list by simply writing a checklist, the zero. 22 00:01:43,540 --> 00:01:45,650 So the position of the element you want to change. 23 00:01:46,000 --> 00:01:51,940 And here I write this one so you can see that when we print the. 24 00:01:53,470 --> 00:02:00,160 Checklist, we should get some changes, some quite significant changes, and you can set up Apple was 25 00:02:00,310 --> 00:02:07,300 changed to test one in our list, then we can do some quite cool operations inside our list. 26 00:02:07,660 --> 00:02:12,610 Let's see, we want to write a list and we want to remove some of the values there. 27 00:02:12,940 --> 00:02:16,080 So let's remove in the vault. 28 00:02:16,120 --> 00:02:19,510 I want to remove is Samsung. 29 00:02:19,760 --> 00:02:20,260 OK? 30 00:02:21,010 --> 00:02:23,320 So if I print. 31 00:02:24,780 --> 00:02:30,330 Then the list I should see that the Samsung has been removed from our list. 32 00:02:30,360 --> 00:02:32,740 Now let's see some other operations. 33 00:02:33,030 --> 00:02:37,950 Let's see what will happen if we would like to insert certain or certain elements. 34 00:02:38,400 --> 00:02:41,930 So let's right here, insert them here. 35 00:02:41,930 --> 00:02:43,560 You need to specify two things. 36 00:02:43,920 --> 00:02:46,650 The index where we want to insert the object. 37 00:02:46,650 --> 00:02:49,080 So you have a presence in the industry. 38 00:02:49,500 --> 00:02:53,130 And let's say I would like the object to be this one. 39 00:02:53,430 --> 00:02:56,550 So this means this will be added to a third position. 40 00:02:57,730 --> 00:03:01,170 And you can see that now on the third position where it was. 41 00:03:01,900 --> 00:03:09,190 Now it's this one and the NHP, they're shifted towards the right side of our list. 42 00:03:09,580 --> 00:03:11,740 OK, that's it here. 43 00:03:12,100 --> 00:03:16,420 And then let's investigate some more operations that you can do. 44 00:03:16,420 --> 00:03:22,120 So you can actually check the length of the string by doing plain and simple, write the name of the 45 00:03:22,120 --> 00:03:23,440 list in here. 46 00:03:23,440 --> 00:03:26,670 You should get printed the length of our string. 47 00:03:27,040 --> 00:03:31,950 So as you can see, our string have five elements and for that reason, its latest five. 48 00:03:32,500 --> 00:03:36,600 You can also get some quite interesting objects for your list. 49 00:03:37,030 --> 00:03:41,950 Let's say we want to check if Microsoft is on our list. 50 00:03:42,160 --> 00:03:45,100 So I will simply write Microsoft. 51 00:03:47,150 --> 00:03:47,570 In. 52 00:03:49,230 --> 00:03:56,430 They placed so here we are checking if Microsoft is syndicalist and obviously the results here will 53 00:03:56,460 --> 00:04:01,430 be a boolean variable and you can see that we get the results through because Microsoft. 54 00:04:01,440 --> 00:04:02,520 Is that our list? 55 00:04:02,760 --> 00:04:05,070 If I were to write this one now. 56 00:04:06,320 --> 00:04:11,570 You are going to see that will get false because we don't have this when our list. 57 00:04:13,250 --> 00:04:14,890 That's it, pretty simple stuff. 58 00:04:16,210 --> 00:04:23,260 Now, finally, if you would like to clear the list, so I will just leave it here to print it, you 59 00:04:23,260 --> 00:04:24,220 can simply write. 60 00:04:25,920 --> 00:04:29,310 The name of the list which the list and then clear. 61 00:04:31,040 --> 00:04:35,180 And now you can see if I tried to print that, I will basically get nothing. 62 00:04:35,420 --> 00:04:39,750 So when you get this break is here, this means that your list is now, guys. 63 00:04:39,770 --> 00:04:43,490 I also want to cover one other topic, which is quite interesting. 64 00:04:43,670 --> 00:04:49,720 And this is a very nice data structure that is very useful when you are developing quotes in Python. 65 00:04:50,120 --> 00:04:59,510 So this is called dictionary and the dictionary usually have a name of an item and assign value to the 66 00:04:59,510 --> 00:04:59,970 title. 67 00:05:00,170 --> 00:05:01,320 I will show you how it's done. 68 00:05:01,580 --> 00:05:08,870 For example, let's say you want to work in a supermarket and you have certain fruits there with price 69 00:05:08,870 --> 00:05:09,550 to each fruit. 70 00:05:09,920 --> 00:05:15,660 So let's write fruits equals and here's how we declare a dictionary. 71 00:05:16,160 --> 00:05:18,680 So the first item will be. 72 00:05:20,010 --> 00:05:24,090 Banana and banana will be equal to the zero point. 73 00:05:25,330 --> 00:05:26,110 49. 74 00:05:28,250 --> 00:05:37,160 Then we're on our list, what orange, what will be equal to one point five for its price will be 150 75 00:05:37,160 --> 00:05:40,340 dollars, let's say then at. 76 00:05:41,640 --> 00:05:49,320 Ethanol, which will be equal to one point all nine or one point all. 77 00:05:50,040 --> 00:05:56,320 So basically this is our dictionary and let's see what else you can do with the dictionary. 78 00:05:56,610 --> 00:05:57,660 So if I write. 79 00:05:58,810 --> 00:06:06,480 Fruits and banana, I can make its price different so I can make the quota to six to eight. 80 00:06:07,030 --> 00:06:13,320 So your footprint, the fruits after that, you see that the price will change. 81 00:06:13,360 --> 00:06:16,070 So you can see that now the price of the banana is different. 82 00:06:16,090 --> 00:06:16,800 It is to six. 83 00:06:17,360 --> 00:06:22,560 Now, you can also just print the price of certain elements with the right fruits orange. 84 00:06:22,810 --> 00:06:27,840 This means that the masking for the price of the orange in the price of the orange is one fifty. 85 00:06:27,850 --> 00:06:31,810 And this is why we have our results to be equal to one. 86 00:06:32,320 --> 00:06:34,600 You can also add items in your list. 87 00:06:34,900 --> 00:06:43,210 So if I write fruits May one equal to three, since melon is not in our list, we don't have such a 88 00:06:43,210 --> 00:06:43,730 fruit there. 89 00:06:44,410 --> 00:06:46,500 This means it will be added the site. 90 00:06:47,410 --> 00:06:54,140 So let's run this code and you can see that melon has been added and its price is three dollars. 91 00:06:54,310 --> 00:06:58,060 And finally, we can simply check if some item is on our list. 92 00:06:58,480 --> 00:07:01,600 So let's check now if the banana is on our list. 93 00:07:02,050 --> 00:07:05,740 If I write the print and then banana in. 94 00:07:07,180 --> 00:07:09,650 Fruits, then I.