Let's solve the next set of questions.
So the first question is a set one by adding the items from set to accept the common items.
So we want to update this set one with adding values which are not already present in segment.
That is, we want to add the value 60 and 72.
You can use any function, anything any more than you will.
Next question is rhenium key city to location in the following dictionary?
So in sort of city, we want to change this particular key to location.
The third questions change Brad salary to eighty five on from given by conditioning's.
So this is a python dictionary where we have different employees and for each employee we have the name
and the salary.
So we just want to update the salary of the person Gragg to eighty five hundred instead of sixty five
hundred.
So you can thornes, though, we do try to solve these questions and then we will go through the solutions
one by one.
So let's go ahead and solve the first question.
So here we have set one and set to to simply find out the values which are present in set one and not
present in said two.
We can find out the symmetric difference.
So let's find out the symmetric difference first.
So let's set one down.
Then it
said, let's see what it is.
So it gives me then 20, 60, 70.
So you can see the values 30, 40 and 50 are common between this.
So we are just getting the values 10, 20, 30 and 60, 70 out of it.
Now, if I want to update this particular thing to the set one,
we can simply say don't update.
So this will simply update the values to secure.
So let's print that one.
So here you can see we have the values in simple.
Instead of updating, you could have also done it this way.
Simply find out the symmetric difference and a sign that does it.
You can follow any method.
Submitting the Prince update is an emplace operator, so it will updated then and then you won't need
to reassign it.
The next problem is to rename the key city to location.
So for this, we can simply apply a simple method.
We can simply create a new key in this particular dictionary.
So how do we do that?
We see a sample
and we create a new key that this location and is inside this.
We want to put in the value which is present in Sydney.
So how do we get the value, present density and simultaneously drop this also?
So what you would have done is you could have removed this key itself and then created a new key and
added the value.
Or you can do both operations simultaneously using the WAP operation.
So we can simply assign some value sample.
They thought up and inside this we give the city.
So what happens is we are able to form the value city from the key value per city, and then we are
copying this key from here.
We what has a property of returning the value to us.
So when we return used a pop operation, it will return the value.
And simultaneously, when we are assigning it to the new key, which we are trying to create, which
is location, it is simply adding the globe, the value to this particular key.
And hence, when we print the sample in the queue,
we get the updated value of location.
So you can use this pop operation in this particular month.
And there could have been other solutions also.
You can try any of those.
Next is where we want to simply update the salary of Bragg.
Now, notice here that this is a dictionary and this dictionary has multiple keys.
These multiple keys are in one and two and three.
And each amp has another dictionary as its value.
So let's try to retrieve the value first and then we try to update it.
So let's give these of the.
And we want to get the value of Bragg, which is under three.
So let's get three.
Let's run this.
So we get named Bragg salary.
Sixty five hundred.
Now, inside this further, what I want to do is I want to I don't want to get the name, but I want
to get the salary.
So let's go for that and get the salary of this person.
When we run this, we get to.
Five hundred now you can simply assign the value what you want, those nine to fifty five hundred.
And now when you run these numbers, you can see the value has been updated.
So you can use this method to reassign the values or you can also see what the values are, and I truly
believe you can go inside different data structures to access a particular value also.
That's it for this one.
You have a lot more similar problems present in the practice sessions, which until practice questions
which are present at the end of the module as well.
So you can refer to those also.
Thank you.