1 00:00:12,270 --> 00:00:13,740 Hi, everybody, and welcome. 2 00:00:13,770 --> 00:00:20,100 Today, we will discuss Stapel and this lecture would cover the advanced part, theoretical part regarding 3 00:00:20,100 --> 00:00:23,490 Topal Thapar is our fourth and last collection. 4 00:00:24,210 --> 00:00:30,690 Let's start over with a quick example, a reminder of how Topal is structured. 5 00:00:30,690 --> 00:00:37,890 It has has round brackets with items inside quotation marks divided with a comma. 6 00:00:39,030 --> 00:00:45,630 Those of you who study hard and follow the lectures would find the first manipulation title very, very 7 00:00:45,630 --> 00:00:46,290 weird. 8 00:00:46,680 --> 00:00:47,850 Change their value. 9 00:00:47,940 --> 00:00:48,680 And why? 10 00:00:49,260 --> 00:00:57,660 Because if you recall, once we discussed Topal basics and two lectures back, I've mentioned Topo's 11 00:00:57,660 --> 00:00:58,710 characteristics. 12 00:00:58,710 --> 00:01:06,390 And the three main characteristics were that topple existing cells that cannot be updated or changed. 13 00:01:07,320 --> 00:01:16,200 New cells cannot be added and existing cells cannot be deleted or so tuple is a basically standstill 14 00:01:16,200 --> 00:01:18,350 collection that does not like changes. 15 00:01:18,570 --> 00:01:23,940 So why do we see a change cell value Tyto here? 16 00:01:24,510 --> 00:01:25,790 Is it even possible? 17 00:01:26,340 --> 00:01:29,630 So the reason that you see it is very, very simple. 18 00:01:29,970 --> 00:01:36,500 This course goal is to bring you to a game into make you into a ninja developers. 19 00:01:36,750 --> 00:01:41,340 I am not looking for mediocre developers finishing these course. 20 00:01:41,550 --> 00:01:49,380 I'm willing to make you and ninja developers and we are not just going to cover the basic part that 21 00:01:49,380 --> 00:01:50,460 you can find online. 22 00:01:50,640 --> 00:01:55,980 You will find you very challenging topics that I will walk you through together. 23 00:01:56,610 --> 00:01:57,230 All right. 24 00:01:57,570 --> 00:02:02,400 So like naturally tuple Topal, sales cannot be changed. 25 00:02:02,550 --> 00:02:08,250 But Python stands for its name because Python is flexible. 26 00:02:08,250 --> 00:02:11,370 And this is exactly what I'm going to show you this video. 27 00:02:11,910 --> 00:02:19,740 So there is a trick that can make you that can give you the ability to change tuple cell values. 28 00:02:19,760 --> 00:02:22,710 Now, we show it to you in the following minutes. 29 00:02:22,920 --> 00:02:23,280 All right. 30 00:02:23,640 --> 00:02:30,150 So we learned in previous lectures that Toppo cells are unchangeable, but still there's a way to overcome 31 00:02:30,150 --> 00:02:32,070 this by declaring. 32 00:02:32,070 --> 00:02:37,380 So, first of all, before it here in the orange box, you can see our declared the fruit tuple. 33 00:02:37,500 --> 00:02:41,040 It has banana, it has berry and mango. 34 00:02:41,280 --> 00:02:47,760 And they're very, very important thing that it's actually not a tuple. 35 00:02:48,120 --> 00:02:49,440 I created the list here. 36 00:02:49,440 --> 00:02:50,580 Let me just change it. 37 00:02:50,760 --> 00:02:51,240 Yep. 38 00:02:51,330 --> 00:02:51,960 Like this. 39 00:02:56,200 --> 00:02:57,010 Now it's good. 40 00:02:59,740 --> 00:03:07,250 Yeah, so I've created here a simple Toppo, and now let's see what we can do. 41 00:03:07,540 --> 00:03:13,420 So first of all, the clearway list collection, just a regular declaration is always you can see it 42 00:03:13,420 --> 00:03:14,620 here in the purple box. 43 00:03:14,840 --> 00:03:18,220 I've created a declaration called Fruit List. 44 00:03:19,540 --> 00:03:29,410 Then after the equals mark, I casted the existing tuple into into a list is the same as casting a string 45 00:03:29,410 --> 00:03:32,360 into an end and int into a string. 46 00:03:32,380 --> 00:03:38,560 Same as we do in print all the time as we doing like as we're doing like this. 47 00:03:39,580 --> 00:03:42,750 Yeah, we're putting a casting into a string. 48 00:03:43,030 --> 00:03:48,070 So this, this is also casting what we see right here in the purple line. 49 00:03:48,700 --> 00:03:51,430 We are casting a tuple into a list. 50 00:03:51,770 --> 00:03:52,950 OK, it's very easy. 51 00:03:53,170 --> 00:03:57,880 So now we have all the items of Toppo inside this first list. 52 00:03:58,540 --> 00:04:04,120 And once we have a list, changing values, adding sales is very, very easy. 53 00:04:04,330 --> 00:04:10,300 And you can see it right here in the third line in the Green Line Ed item into the list. 54 00:04:10,510 --> 00:04:12,520 This we already know how to do. 55 00:04:12,670 --> 00:04:16,420 So I'm just adding cell number in index number one. 56 00:04:16,420 --> 00:04:17,740 I'm adding a Strawbery. 57 00:04:18,430 --> 00:04:19,000 All right. 58 00:04:19,450 --> 00:04:29,830 And then after I added it, I'm casting the list back to topple here in the light light. 59 00:04:31,650 --> 00:04:38,520 Blue collar cast back double, so you see here, the Topal keyword bolded, and inside it you see the 60 00:04:38,520 --> 00:04:38,950 list. 61 00:04:38,970 --> 00:04:46,110 So this casts back to topple and fruit stubble has now the strawberry item inside it. 62 00:04:46,800 --> 00:04:47,640 It's cool, right? 63 00:04:48,090 --> 00:04:51,390 So by nature, you cannot change the apple cells. 64 00:04:51,600 --> 00:04:58,260 But if you cast it into a list, then you can add your your cells and then cast it back to double. 65 00:04:58,440 --> 00:05:03,870 This is exactly what developers are expected to do to think outside the box. 66 00:05:04,700 --> 00:05:05,130 All right. 67 00:05:06,330 --> 00:05:14,300 From here, let's head off to the last next and last manipulation that we learned here in advance. 68 00:05:14,320 --> 00:05:15,120 Double lecture. 69 00:05:16,020 --> 00:05:23,070 If you want to create a single cell tuple and we naturally going to do it like this, just declare it. 70 00:05:23,070 --> 00:05:27,780 And inside the brackets, inside quotation marks, put our value. 71 00:05:27,930 --> 00:05:30,080 This will give us a wrong. 72 00:05:30,840 --> 00:05:32,520 This will give us a wrong result. 73 00:05:33,180 --> 00:05:34,010 And why? 74 00:05:34,290 --> 00:05:42,690 Because if later on we want to type one to print the type of the variable that we just declared, you'll 75 00:05:43,080 --> 00:05:44,580 remember this one, by the way. 76 00:05:44,580 --> 00:05:48,960 I've mentioned it in the previous lecture and in previously lectures as well. 77 00:05:49,140 --> 00:05:56,580 So once we print the type of something we can get the output, which will be the type of the variable 78 00:05:56,580 --> 00:05:57,490 or the collection. 79 00:05:57,960 --> 00:06:02,670 So in our case, once we print this out, we'll get an output of string. 80 00:06:03,120 --> 00:06:04,650 So this is not what we want. 81 00:06:04,890 --> 00:06:07,270 We want to create a tuple with a single cell. 82 00:06:07,470 --> 00:06:09,720 So how can we actually achieve that? 83 00:06:10,440 --> 00:06:13,580 We can achieve it by using this manipulation. 84 00:06:13,740 --> 00:06:21,570 We just declared tuple and inside after we we put a single cell here, we just also leave a comma and 85 00:06:21,570 --> 00:06:22,890 then we close the brackets. 86 00:06:23,100 --> 00:06:27,990 Then once we try to print out the type of the output will be tuple. 87 00:06:28,890 --> 00:06:31,130 So this part is irrelevant. 88 00:06:31,440 --> 00:06:31,820 Yep. 89 00:06:32,400 --> 00:06:37,230 And this is easy, but it's important to know. 90 00:06:37,500 --> 00:06:43,440 And once you leave, you leave a comma here, the type of it will become Toppo. 91 00:06:43,920 --> 00:06:44,340 All right. 92 00:06:44,350 --> 00:06:48,630 So this concludes the theoretical part of each advanced Stupples. 93 00:06:48,810 --> 00:06:54,930 In the next video, you will see some challenging assignments regarding tuple, and this would conclude 94 00:06:54,930 --> 00:06:57,660 our collection part in our course. 95 00:06:57,900 --> 00:07:02,760 And then we will go straight ahead for more interesting topics. 96 00:07:03,300 --> 00:07:08,250 Topic part was a bit long topic, but very, very important. 97 00:07:08,430 --> 00:07:12,780 So don't underestimate it and practice it in the next video. 98 00:07:13,080 --> 00:07:13,820 Thank you. 99 00:07:13,830 --> 00:07:14,390 Bye bye.