WEBVTT

00:00.920 --> 00:01.280
Okay.

00:01.320 --> 00:08.760
After we learn something about tuple list, now it is time to learn about sets.

00:09.040 --> 00:10.880
Okay, what is it?

00:10.920 --> 00:14.840
Sets is also a it's a collection.

00:14.880 --> 00:15.960
Okay.

00:15.960 --> 00:22.680
It is not ordered means it doesn't have any index is not indexed.

00:22.680 --> 00:26.320
And in Python sets are written with curly brackets.

00:26.800 --> 00:29.360
For example I am going to create.

00:31.360 --> 00:32.520
It is equal to.

00:33.120 --> 00:40.920
You use curly bracket for this and then name of the some fruits like apple.

00:42.680 --> 00:46.120
What is the other one is like banana.

00:48.280 --> 00:51.800
And we have cherry okay.

00:53.400 --> 01:03.320
So now this is a set and it is not ordered means it doesn't have a index okay.

01:03.320 --> 01:04.280
It is not zero.

01:04.320 --> 01:05.120
This is not one.

01:05.120 --> 01:06.920
This is not two okay.

01:06.920 --> 01:13.880
So you cannot print these elements using the index because it is not ordered.

01:14.440 --> 01:21.190
So now let's use print and then use roids and save it.

01:22.830 --> 01:28.870
Open a new terminal and let's run this and see what is going to be happen.

01:28.910 --> 01:37.630
Okay city Python basic and let's use Python and sets.py.

01:37.670 --> 01:38.750
Hit enter.

01:38.790 --> 01:43.190
Now you see that it is printing all elements with curly brackets.

01:43.630 --> 01:46.830
And also those, uh, question marks.

01:46.870 --> 01:47.310
Okay.

01:47.950 --> 01:52.270
So how can I print, uh, element which is inside this.

01:52.310 --> 01:52.510
Okay.

01:52.550 --> 01:56.270
Each element again I need to use a for loop okay.

01:56.310 --> 02:02.390
To navigate through this fluids this set and then print all element.

02:03.150 --> 02:05.030
And let's go see that okay.

02:05.070 --> 02:09.830
For example again x in right.

02:11.470 --> 02:13.510
And the x okay.

02:13.510 --> 02:16.630
So this will come and start navigating through.

02:16.670 --> 02:16.950
Okay.

02:16.990 --> 02:19.590
So it will come and traveling through this.

02:19.630 --> 02:19.870
Okay.

02:19.910 --> 02:25.510
First it will print apple the next line banana in the next line cherry.

02:29.550 --> 02:31.570
See we Have cherry.

02:31.610 --> 02:34.850
We have apple and we have banana.

02:35.290 --> 02:40.490
So it is how it is working.

02:40.650 --> 02:41.050
Okay.

02:42.810 --> 02:46.290
And it is not ordered because of that.

02:46.290 --> 02:48.090
It is not printing first.

02:48.130 --> 02:48.570
This one.

02:48.610 --> 02:48.890
Second.

02:48.890 --> 02:49.410
This one.

02:49.450 --> 02:49.650
Third.

02:49.650 --> 02:49.970
This one.

02:49.970 --> 02:51.050
Because it is not ordered.

02:51.050 --> 02:57.170
So it is printing cherry, apple, banana and the other one.

02:57.210 --> 02:57.770
Okay.

02:57.810 --> 03:00.210
See this time it is apple, cherry, banana.

03:00.850 --> 03:03.530
And this time it is banana, apple cherry.

03:03.530 --> 03:06.530
Because of that it is not ordered.

03:06.530 --> 03:13.130
So it is how you can create a set and you can use it okay.

03:13.530 --> 03:14.730
Also we have.

03:16.930 --> 03:19.770
Other options for this okay.

03:19.810 --> 03:22.090
For example we can add element.

03:22.210 --> 03:27.330
We can remove element and we can update.

03:27.890 --> 03:30.370
We can print the length of the set.

03:30.690 --> 03:35.650
And a lot of things that we can do a lot of operation that we can do with set.

03:35.970 --> 03:44.290
But later we will see them with, uh, more examples through the course while we are using it into the

03:44.290 --> 03:46.130
real operation.
