Biton sits.
So that is another data type available in Biton.
In Biton is Asset is an unordered collection of unique items, no duplicate elements are allowed inset
and must be immutable weapons, which cannot be chanced.
So Hoeber, the SEC itself is mutable.
We can add or remove items from it.
So now we have defined what is a set and in Python we usually include the set within Karlee process
has set.
Members must be unordered and they'll be.
Each and every item will be unique in values.
So safes can be used to perform the mathematical set operations like your union intersection, semantic
difference and so on.
So here we are different, discussing what is a said union.
So let us suppose is said, Visa said.
And if we do the said union, that is a union B..
So these are the elements of selecting DePrince, where selecting all elements either belonging to A
or B or both.
We're going for the set intersection.
So if you take the intersection between the set A and B, then all those elements will be belonging,
which are common between A and B sets.
Here you is actually standing for the universal set.
Next one is a set, operations continue.
That is a sad difference if you do A minus B, if you do A minus B, then you're the with those elements,
which will be in A, not in B, but if you do the set set symmetric difference in that guess.
If you go for a set semantic difference, B, then those elements and B will be selected which are B
either in A or B not in common.
So here we're it been done by on set methods.
So, Ed, so we can add or an element to set clear, remove all elements from a set, copy returns,
a shell, a copy of acid.
Next one is a difference written the difference of two or more sets as a new set.
They're going for the difference.
Bit discard.
Remove an element from the set.
If it is a member.
Do nothing.
If the element is not belonging to the set, not the member of the set intersection intersection a bit
is disjoined return true.
If two sets have a null intersection is subset return two.
If Energous set contains this particular set.
We're having this is superset.
We are having this pop.
That is the pop method.
That is a remove and return, an arbitrary set element.
It is clear if the set is empty.
So in the scene, you see all the methods we have discussed with the respective shot discussions.
OK, next one is all return to if all elements of the set are true.
So these are the list of guitars which are Biton building functions, Witchey, which are applicable
with set also.
So any return true if any element of the set is true.
A new Monett return, an inanimate object.
It contains the index and the value of all the items of the set as a pair.
So index.
That is a position number and the value.
So that can fall appear.
And that'll be printed.
That will be the output here.
So now we are going for this line.
That is the return, the length.
That is a number of elements in the set.
So these are the other methods that there.
These are the python building functions which can be applied on the set.
Day-To-Day.
So I think for the better clarity, let us go for one practical demonstration to show you that how this
might parts can be applied on the set.
And before that, obviously, we should we should show you that.
What did the what is the set?
How to define it?
And what are the different basic operations which you can carry out on a set?
So here is the demonstration for you is set is an unordered collection of items.
That means within the items, within the members of the set.
That is no ordering the elements.
The items can be in an audit and every element must be unique.
No duplicate elements will be allowed in a set and must be imitable.
That means those elements cannot be updated, cannot be changed.
However, the set itself is mutable.
That means we can add audry move.
Items from asset sets can be used for two parts from the mathematical set operations like about union
intersection, symmetric difference, etc..
So let us discuss how to create one set here to define one set of integers.
It gets upset.
The elements will be separated by commas and the whole set will be enclosed within Culebras.
So if I predict you can find that the state has been formed, if SCIP may have different type of data,
that means elements will be form mixed together types.
So here we are having this hundred and one of the type of integer level is of the type of string.
And here you are having one couple.
The couple can be also asset element.
So he can find that the respective mindset, too, has got printed.
If we vilely defining one set.
If I put some duplicate Palouse, then those duplicate values will be eliminated.
Only the unique values will be there in the set item.
Italy.
Now, in this case, is it cannot happen, mutable items.
Here you can find that we are defining one set or at least is as one of the elements.
But list is containing mutable items, so this particular set cannot be formed.
So if I go on printing.
If I tried to form a view, I could define one set here, then type it, it is coming.
And on cashable type list is their respective error message.
So you can find that creation of a set from the list as one of the elements is not possible.
So we can make a set.
But we can make a set from a list using the method set.
So here we are having one list.
You are doing one method set here and then we're going to get one set accordingly.
I know if I want to make one list from this set, the set will be inkless within the culebras us.
And here we're using the method list.
And then we can get a list from this set here so we can find that we have got one list here.
And here you can find the type of the mildest one.
So it had the class type.
Is the list here.
Next, we're going for operations on a set.
So on a set, we can perform multiple different operations.
So let me go one by one.
So at first, we're defining this particular set here, having the value element, 32, 44, 66 and
55.
You can see this set of values that there might be in the different order.
So now the set members cannot be accessed using index.
So zero is the index.
So if I want to access the mindset one zero if I want to access this one, it will be coming.
And that type of the name of the ADA is type ID and set object does not support indexing is the ADA
message.
So that means I cannot do this one.
That means indexing is not allowed.
Not getting supported on a set.
OK.
Next one is that so if we go for adding one single item so we can use the method and so in that case,
77 will be added as one of the elements.
But if I want to add multiple items, then you can go for the method update on here.
The multiple items are to be enclosed within squared records.
That means it is a list.
So list of items can be can be passed as input argument to the method.
That is our object.
In that case, you can find that 88 at 19 and 22, the three values have got added to the set.
Now you see, we can go for the object in that case of object.
We can add a list.
We can add a set.
So here to see a hundred three hundred, four hundred five.
They are nothing but a set and hundred and hundred two.
They're nothing but a list.
So looking at the brackets enclosed you can easily find and then you can find that this particular mindset
one is having those values included an added.
Now we are going for the remove and discard so you can find that in case of remove and discard.
So initialised mindset, so ETWAS mindset, one has got this set of values and we have printed that
one.
Now we are going for the discard for that mean discard an element which is not present, but you can
find that no Edward is coming, no error message is coming because the discard will handle that error
at any institution.
So my let's set one.
If we go for my set one printing then I'm getting the same set of items.
But if you use the instead of using the method discard.
If you use the method remove.
And if you pass of an element which is not there in the set, you'll be getting one error.
So I'm just going to show you that one.
So this is known as the name of it.
So that is a name my set is not defined here.
So let me go for this myself.
One, I think.
OK, so now if I go for this, I can find this one.
That is a key here.
So that B6 is not present in that respect.
Dipset because you can find that six is not a prison yet, but 66 is present.
So citizens can be deleted, can be removed.
So it gets off in goes up.
So one very big difference between this discard and this remove is that in case of discard if the element.
What about we are passing as input argument is not present.
It is not producing any error.
But in case somebody move, it is producing a error.
And the name of the ADA is skier.
Now, if you go for that discord 44, if I want to bring this mindset one, in that case, I can find
that this 44 has been deleted.
If you go for this remove 55 and 55 is existing, the respective 55 will get deleted from the set.
So now here we're going for the method that is the pop.
And here we're having one set defined.
And now we're going for this mind set, one dark pop method, and then we can find that category has
been pop popped out, has been deleted.
If you go for another time, pop metal, that 66 has been deleted here, this particular values can
be selected randomly.
So clear my set.
In that case, the set will be existing.
My set one will be existing.
But it's all its elements will get cleared.
So anybody I'm going to print my set one.
After issuing this clear method, we can find that at the city's existing.
But no elements out there.
Let us go for different set operations.
Sackfuls, we're going for this union.
So we're having my set one.
We're having mindset.
We have printed those two sets.
Now, this union can be done using the idea, using the operator filter or using this method DOT union.
So my set one dark union mindset, too.
So I have shown that in whatever the way in which we're doing that union, ultimately we're lending
to the same result.
That means union is taking place in gives our union the duplicate values, will be offering ones.
So four and five, the other duplicate values between these two sets.
My set one mindset too.
But they will be all once because set will all is a coalition of unordered, distinct elements.
So they'll be auctioning once, ultimately in the union after union.
We're having this intersection.
Next one is our intersection.
You can find that mindset one and Mindset two at having the set of values it.
And if you go for the intersection, then we are learning with this four and five only intersection
can be done using the operator ampersand, all using my set one dot intersection mindset to.
Next one, you are going for the set difference.
So it gets upset difference that you can use the operator.
That is a minus.
Are you going to use the method that is in dissection so you can see that only the common elements will
be coming out from the intersection?
So this is another very important operations on set.
So we are finding that four and five are the common elements in between the set mindset one and Mindset
two.
So they are coming out.
We are going for the set difference.
So here we are having this what this mindset one on my set, too.
So the respective values are there.
So now when you were going for this asset difference, then mindset one minus mindset to you will be
landing with this one due to one, two, three, four and five will be will be discarded because four
and five, the other common in my set one and mindset two.
But if you go for my set to minus my set, one will be getting this one, that is the eight, nine,
six, seven and four and five will not be there.
Next will we can do the same, either using operator minus or using the method difference.
So we'll be getting the results accordingly.
Now we are going for the Semitic difference in terms of semantic difference, the common element in
case of Semitic difference, that common elements will not be coming.
So now how can we do for the Semitic difference?
It'll be going for this upper carrot.
So this is a symbol upper get it.
So also known as hack.
So I did.
You can go for this operator.
AIPA carrot are symmetric, underscore defiance.
So that is another method.
So here you can see that all the elements are there, are there.
But only the common elements which are common.
That is a four and five between mindset one and mindset two.
They are not coming after doing the symmetric difference between my set one and my set two.
Now we are going for this membership check.
So now here we are having one assembly set is defined.
That is the mindset one, two in my set, one that is quite obvious.
True, because two is one of the elements.
One.
One of the members of this mindset.
One outcome is to a true here.
So six in my set, one six is not there.
Outcome is false.
Do not in mindset one.
So that is produce and outcome false.
Because two is that.
And six.
Not in my set.
One.
Its outcome is true here.
Now we are going for this itr iterating through a set.
So for later in set will come Brint later.
So in this way you can find that for each any retaliation.
We are picking up one of the characters from the string.
Welcome.
And that is getting printed.
Now we are having some inbuilt functions with the set, so they are nothing but Len Max main shotted
so lint will denote the number of elements.
We can have six elements in mind set one.
So lengthiest printing Len is printing six eight is bending the maximum element.
Here it is, five minutes bending the minimum element of the set members.
It is printing zero are the shortened my set one will print does set in the shortened form and outcome
is of the type of list.
But having this Flooz inset so python froze insect frozen set is a new class that has the characteristic
of a set, but its elements cannot be changed once assigned.
So while doubles are immutable, lists and frozen safes are imitable sets here.
So we cannot do any kind of update and change on this for the insect.
So we know that doubles are the imitable lists and fruit inserts are imitable sets here.
So here you have defined two for the insect.
That is the mindset one and my set to define them and then we are going to print them so the values
up got printed.
You can find that when I'm printing this mindset, when it is getting printed.
As for the inset and here we are having the first brocades.
Then within that we're having this Garley Bliss's, that is the settings there.
And then we're going for this difference or dot difference.
My set one dark difference mindset.
We can get this one and two because one and two will be the elements which will be all joujou.
Be there as outcome three unfold will be deleted because three and four are the common elements between
this Mindset one and mindset two.
We're gonna go for that union.
We're getting this outcome like this.
We're going for the intersection.
Only the common elements are coming also to unfold.
We can go for the Semitic difference.
Only three and four will get discarded and risk elements will be there in the present set.
But if I want to do some addition, if I do addition of a new element.
So in that case, it case a frozen said it will produce either at this age that is known as the attribute
error.
Pruzan set object has no attribute add.
So that's why this is the illustrative error we are facing because of rodent's.
It is nothing but a musical version of a set here.
So in this, our discussion, in our discussion, we have gone through different operations on sets.
We have shown what are the different and it will the functions, how to define instead what can be done,
what cannot be done.
And we have discussed everything with some examples here.
Thanks for watching this video.