Hello, in this section, we will discuss about sex, so first of all, let us see what a said is.
Asset is the type of data structure which contains multiple elements, these elements are unordered
like dictionaries.
They do not have any fixed position like lists, and also the elements have to be unique in nature.
So here we have two sets, A and B in this particular picture, the set, it contains four values,
one, two, five and six, while the Set B contains three and nine.
Here's the set.
A and B do not contain any common values.
And the entire data is called a universe.
A universe is contained of a lot of six.
Now, let us see this particular image.
So here we have said it can be very sick.
It is a complete.
Set of values which are present in be so set me contains value one, two, three, four and five miles
set.
It contains value for two and one.
Because the values presenting are also present in being is actually a subset of B. Riley B because it
is larger than E, and it has values from A, it is called a superset, please, not for a sect to be
a superset of E, it should contain all the elements present in.
Or for it to be a subset of all the elements presenting it should be a part of the.
Now, let us see another example here, if we consider that envy and get the values, the job doesn't
involve envy.
It is called a union office.
And if they are interested in the values which are common between A and B, they are called an intersection
of A and B, in case we want to find out values which are present only in A and are not pleasant.
And B, this is called a difference of A and B a semantic difference is a union of A and B, and we'd
surprise the intersection of envy from it.
So.
Semantic difference is union of in B minus the intersection of.
And now let us see this with data.
So here we have to set the uncute.
The union of the MQ will be having elements from the uncute, so the Union of the Amcu will have values
nine three six eight to enforce an intersection of A and B. So here an intersection of the N.
Q will contain only six.
Because sex is the only value which is common between being and.
Now let's find out the difference between A and B. So here the minus Q will be only nine and three because
sex is the only element which is present in both of you.
So the difference between the and will be nine and three.
If we subtract B from Q, then the difference will be eight, two and four.
So the values of B minus Q and Q minus B are entirely different.
The values of symmetry of difference will be nine, three, four to eight.
That is the union of being equal minus the value of six.
So the entire set, except for the value which is common between the two, is called the symmetric difference.
Now, let us see how we can hold this in.
So let us list down the features of sex also so it will be unordered.
It will have unique values.
And.
It can have elements.
All different data.
Now let us see what all operations could be done.
We can add value, we can remove a value, we can do union of different sects.
We can find out the intersection between the sets.
We can find the difference.
And the cement.
Patrick.
Difference between two six.
Now, let us see how we will do that, so let us create two sets.
So let us create.
A steady and steady the values were set and said B will be, let us say we will create it by creating
daily basis and inside these gaudy places we will put in the values which we wanted to have.
So let us say it has value a.
We.
Hi.
S..
D and let me have high.
Ex.
Why?
Said and let us increase the number of common values.
So let us have see also this one and let us have.
And in this one, let us have the values X as.
So let us run this.
So here we can print tea so you can see it has all the values which we have created.
Now let's see the type of E so the type of E said, let us try to add multiple values.
So let let's try to add more X and more.
So if you do this and let us see, the E will contain only one occurences of these values, no value
will be repeated.
Now, let us see how we can use different operators, so let us say we want to find out if a particular
value is present in an sec.
So let us check if.
A.
Is present in.
Set.
So when we done this, we get through as an answer.
Now let us try another scenario.
Let us check if he is present in a.
So it gives back false.
Now, let us say we want to add another value to our set so we can do that by.
Steg.
B Q are.
And we want to do it so we will see a dot on.
EQR.
So we just want to add you are to the city and let us check again.
So here you can see the value here has been added and there is no specific ordinance, so it just got
added.
At some position now, let us try to remove a particular value.
So let's say we want to remove a particular value so we can save a dot and lose.
Hi, so we are just trying to remove hi from this and then we'll print it so you can see we have successfully
removed high from.
Now, let's see if we want to trade on top of the set, then we can simply use for loop so we can say
for Vul or any Weeble in the safety.
And we can see Brent.
Well.
So it has printed the volumes I'm here, you can see that, although that is as it seems like there
is an order present every time we print visitors printing A, B, C, D in alphabetical order.
But when we actually try to trade on top of this particular set, the volumes are coming out randomly.
So now let's try another thing.
So let's try to do a union of these values, so for doing an onion, you can say let's create a new
sexy and we can see is equal to a union.
The latest princi, so here you can see when we did a union of A and C, it just gave the entire list
of values that are present in and the world and combined it together and created the sexy for us.
And you can see all the other values, C, D and X were common in A and B, but still the sexy does
not contain multiple occurrences of this.
There is only one occurrence of these values.
Now, in case we want to find out an intersection, we can simply see a DOT intersection.
B.
And you can see we got the intersection values of A and B, which is C, V and X, which were common
values, which we created.
Now, in case you want to check, if a particular set is a subset of another set so we can use is subsid,
so let us try to check if a dot is.
Subset of B. So when you run this, you get a fall.
So this means that is not a subset of B.
Now remember, we created C and C was a union of E and B, so C contains all the elements of A and B.
So if we say C, A subset of C.
Sorry is subset of see, so it gives a true that is it is a subset of C and similarly if we try to do
it on V, so which is a subset of C, it gives a true value.
So this is how we can check if a value is a subset.
Now if you want to check if OPSEC is a super sick of another set, we can do it by C dog is superset.
Of the so it gives a true value, which means that is a superset of the now another thing which we can
do is we can find out the difference and the symmetric difference.
So let us try to find out the difference between A and B..
So a dot difference.
The.
So we can get the values of a job as an only in a. and not in the.
We can find out the difference.
A.
And let me bring the values of.
A and B here's.
So that you can see what other differences.
So here you can see that the value of A is B, B, C, E, X and B, while the value of B is DC high,
H, A, Z, X and Y.
So here are the values which are present only in A are A, B and B QR.
Similarly, here we are finding a difference of B minus E, so the values which are only present and
B are high Y and Z, so that comes up with the result of.
The difference now is they want to find out symmetric difference so we can do it by simply stating it
not symmetric.
Defense.
The.
And gives this value and we can simply find out we got symmetric defense.
So here you can see that the symmetric defense is seen from either direction while defense has different
values based on the value which we are subtracting it from.
So subtracting B from E, then it has the values which are only present in A Anovia, subtracting E
from B, then it has values which are present only in the.
Thank you.