WEBVTT

00:01.220 --> 00:10.010
Hello, in this session, we would be discussing about apples to apples, immutable in nature, so we

00:10.010 --> 00:16.790
can consider apples just like list, but with the properties of immutability.

00:17.570 --> 00:26.510
Now, when we talk about immutable, immutable means that the element of that particular data structure,

00:26.510 --> 00:35.390
which is dapple here in this case, cannot be modified so that others can have new people object, such

00:35.390 --> 00:36.130
as list.

00:36.320 --> 00:48.020
So the elements of the couple could be mutable in nature, but the element cannot be modified as such.

00:49.220 --> 00:57.110
These Stupples elements cannot be changed, but it's multiple elements can be changed, so let us see

00:57.110 --> 00:58.820
how this entire thing works.

00:59.880 --> 01:08.700
In case of couples, we can define couples in this particular format, giving people list inside this,

01:09.510 --> 01:17.430
or we can provide the object separated by comma inside bases, which would create a new double for us.

01:18.410 --> 01:26.330
Now, another thing which we could do is we can just give the couple's name and the account, which

01:26.330 --> 01:33.350
would provide us the number of elements present in that, and with the index, we can add value to a

01:33.350 --> 01:34.140
particular topic.

01:34.400 --> 01:37.240
So let us see how this entire thing works.

01:40.410 --> 01:49.380
So let us first create a topic, so let that happen in the city and we wanted to have several elements,

01:49.680 --> 01:50.820
so let us say.

01:52.730 --> 01:54.300
I want to have this number.

01:57.400 --> 02:00.900
And I want to have a springboard to present Philip.

02:04.330 --> 02:09.940
And one of the number, the intimate, so this is my double.

02:10.420 --> 02:14.240
Now I can go into my company using fake.

02:15.110 --> 02:18.150
So here you can see this couple has been created.

02:18.160 --> 02:19.810
I can check the type of.

02:25.420 --> 02:32.910
So it is a topic now we can create a couple with another method.

02:34.920 --> 02:38.070
Here we are simply giving the values common, separated.

02:38.580 --> 02:43.800
We can also give the values, comma, separated inside of basis.

02:47.060 --> 02:53.050
So this is just the same thing, but only additional bases have been provided here.

02:54.410 --> 03:03.110
Apart from this, I can create another couple by having a couple inside this, so when we can do is

03:03.980 --> 03:12.410
let's say I want to create a you and inside this stuff, I want to have that ability and I want to have

03:12.410 --> 03:15.110
another double which got these values.

03:15.110 --> 03:15.690
Three, four.

03:15.720 --> 03:17.810
Obama seventy eight.

03:19.200 --> 03:20.580
And let me bring to you.

03:22.500 --> 03:28.590
So here I have unestablished, which has supples inside this.

03:31.230 --> 03:39.600
Now, let's try to see the properties of immutability in case that happened, so when we say immutability,

03:39.600 --> 03:43.480
it means that the elements of the couple can not be replaced.

03:44.280 --> 03:48.980
So let us stay if we want to have value.

03:48.990 --> 03:49.710
See you.

03:50.800 --> 03:53.890
And I want to create a new value inside this city.

03:53.910 --> 03:58.060
I want to take the index value, let's say I want to check the index, see why.

03:58.660 --> 04:00.460
And I just done this.

04:00.730 --> 04:05.320
So you can see I get the value of the index one in.

04:07.240 --> 04:14.800
Now, let's I want to add another value to this topic, I want to add value in the index to.

04:16.290 --> 04:16.860
So.

04:18.430 --> 04:23.950
Let's see if the value exists or not, so it does not exist, double indexes out of range.

04:24.390 --> 04:33.460
Now, let us try to add a simple number inside this, which is immutable in nature, so that if an object

04:33.460 --> 04:42.940
does not support assignment, which means that once the tuple has been created, I cannot really add

04:42.940 --> 04:44.350
another element to this.

04:46.260 --> 04:53.330
Let us see another thing, let us try to modify the element which is already existing, so let us try

04:53.330 --> 04:57.310
to replace some element in the self.

04:57.330 --> 04:59.720
So let us check the value in the.

05:01.430 --> 05:04.730
Three, let let's see what is value in these three.

05:05.090 --> 05:12.890
Well, the value in these three now let me try to put another value in and save fifty for.

05:14.160 --> 05:22.380
And you can see that the double object does not support the assignment, so I cannot assign the value

05:22.380 --> 05:26.670
for people to the third element in the double.

05:27.870 --> 05:33.100
Now, let us bring to you again here is that apathy?

05:33.510 --> 05:36.180
Now, let us try to do one thing.

05:36.390 --> 05:39.250
Let us try a few things.

05:39.250 --> 05:42.880
See this string.

05:43.740 --> 05:47.050
Let us see if the string value can be replaced with that.

05:47.200 --> 05:51.420
No value cannot be replaced, but legacy for string value can be replaced.

05:52.710 --> 05:53.400
Now.

05:55.330 --> 05:57.580
This is index zero one two.

05:58.900 --> 06:05.800
And in the inside this I want to I want to pull the string itself so it is not a very huge.

06:07.830 --> 06:14.160
Change, which I want to bring in inside instead of Halo, I just want to put in high and this is again,

06:14.160 --> 06:15.040
not supporting.

06:16.440 --> 06:25.010
So you can see the property of the couple is that the values are present inside this, if any index

06:25.050 --> 06:26.380
cannot really be replaced.

06:26.610 --> 06:30.880
Now, let us give this to you inside this new couple.

06:31.260 --> 06:33.570
We have a value.

06:35.620 --> 06:37.570
Thirty four, former seventy eight.

06:38.870 --> 06:40.670
So let me try to replace that.

06:41.660 --> 06:53.120
So let me try to modify this on inside you one, I want to go to another value saying I want to go with

06:53.120 --> 06:53.360
you.

06:54.460 --> 06:56.660
So this is, again, not supportive.

06:57.040 --> 07:03.220
Now let us try to do another modification, so let us try to modify this value.

07:04.060 --> 07:07.330
So first we try to retrieve this particular value.

07:08.740 --> 07:17.380
So let us see you and inside this view, I want to get the first one with the terrific almost seven

07:17.600 --> 07:22.300
eight and I want to get the zero one insight this just thirty four.

07:22.450 --> 07:25.650
And I want to assign a value to to it.

07:26.320 --> 07:32.420
So this again is not possible because this is again.

07:33.820 --> 07:37.660
Now let us try on a third, let us try on the radiation.

07:38.710 --> 07:43.780
So let us create a double the one and now this time this stuff.

07:43.990 --> 07:47.430
We have values like one, two.

07:48.160 --> 07:51.640
Then let me put a list in it.

07:51.790 --> 07:55.270
One, two, three, four, five.

07:56.690 --> 07:58.220
And now let me put.

08:00.060 --> 08:01.140
And at the in.

08:03.380 --> 08:06.620
Hello, and let me put.

08:07.810 --> 08:12.550
Another couple in it, so we have already seen the example of what happened inside this.

08:18.620 --> 08:27.890
But still, let's try this again, so in this one, this is the one for me now in this one, let us

08:27.890 --> 08:31.970
say I want to modify this element, which is a list.

08:32.480 --> 08:37.940
So let us retrieve this was 41 and inside the one.

08:37.940 --> 08:40.310
I want to get the second index.

08:41.400 --> 08:42.730
Which is the list itself.

08:43.080 --> 08:47.920
Now, let me try to modify this by assigning another list instead of this one.

08:48.330 --> 08:54.600
So let me put in one, two, three, four, giving the series also the same.

08:55.670 --> 09:03.770
And let me try this, so this is, again, not supported, so this means that no matter what element

09:03.770 --> 09:09.000
is present in adopting, that element cannot be replaced either.

09:09.020 --> 09:10.130
It is a no.

09:10.430 --> 09:11.900
It is us doing.

09:12.290 --> 09:13.640
It is a list.

09:13.940 --> 09:15.080
It is adopted.

09:15.290 --> 09:17.200
That element cannot be replaced.

09:17.360 --> 09:24.440
So once you have created a couple, the element of that that cannot be replaced, no new element can

09:24.440 --> 09:26.070
be added element.

09:26.090 --> 09:27.500
Would we be OK?

09:27.710 --> 09:33.110
Now, one more thing to understand here is this is a very important property of the.

09:34.500 --> 09:42.960
Which is, although I cannot replace the elements of this, I cannot modify this one to any other value,

09:42.970 --> 09:51.810
to any other value, but what I can do is because one is immutable in nature, I cannot modify the value

09:51.810 --> 09:54.060
of what I cannot modify the value of.

09:54.330 --> 09:56.220
I cannot modify the value of string.

09:56.220 --> 10:01.320
I cannot modify the value of it because these are immutable items.

10:01.650 --> 10:12.090
That list is in itself usable image, which means that I can modify a simple list.

10:12.540 --> 10:16.620
So let's see if I create a list, say.

10:17.760 --> 10:26.390
Any X, Y, Z list, which has some value, one, two, three, this value of this list can be modified.

10:26.610 --> 10:34.770
But if I had a couple that I modified so I can either create like another string, although I can create

10:34.770 --> 10:39.450
a new string, I can create a new number, but I cannot create a new couple.

10:40.020 --> 10:42.660
I cannot completely change that up a little.

10:43.020 --> 10:44.910
So what we do here is.

10:47.020 --> 10:55.970
I can modify this list, this list, so let us try it on the lady, so in the one which is next door.

10:56.260 --> 11:00.610
Let me try to get the value of the second index.

11:01.030 --> 11:02.560
So this value is three.

11:03.790 --> 11:06.950
Now, let's see if we can actually change this volume.

11:07.620 --> 11:12.220
OK, so let me bring it to you one.

11:13.120 --> 11:15.670
So this is my original D1.

11:17.570 --> 11:19.340
And out of this one.

11:20.680 --> 11:26.190
What I want to do is I can change, I want to change this value tree or let's say I want to change this

11:26.200 --> 11:26.560
value.

11:26.560 --> 11:27.510
Hi to hello.

11:28.540 --> 11:29.860
So that would be.

11:31.350 --> 11:31.800
Three.

11:33.150 --> 11:44.820
And I want this value to begin with, hello, and let me die of this and let me be one again so you

11:44.820 --> 11:55.140
can see that although I cannot change the values of the couple itself, but if the element of the couple

11:55.500 --> 12:06.210
is mutable in nature, which is I believe it is a list or it is a dictionary or it is a sect, I can

12:06.210 --> 12:12.780
modify the value inside that list, dictionary or step.

12:14.360 --> 12:23.590
But if it is a string, a number or another couple, I cannot modify those values.

12:23.780 --> 12:30.140
So this is the only property which you need to remember about the carpet, which would be sufficient

12:30.140 --> 12:33.320
for you to be walking in future.
