Hello and welcome.
In this video, we will talk about the assignments of dictionary, the advanced level, and before that,
let's have a quick review of the last lectures topics.
So, first of all, we've studied some complex topic which is nested dictionaries.
And there we saw basically that we have two types of cells.
We have a parent cell, which is what we have in a simple dictionary.
We have a cell in the cell.
We have key and value.
And also we have this thing called a child cell or a nested cell.
And basically what that means is that we have a key on the left side and on the right side.
Instead of having only a value, a simple one value, we have a nested cell which also contains another
another key and another value.
So this is the nested dictionaries that we've been over and we saw examples as well.
Right after we went to, we started to discuss of manipulations that we can apply upon dictionaries
and same as we did, unless we saw here, several things were to be that we can do upon a dictionary.
First of all, we saw how can we extract a value by using the key?
And we saw a comparison of how we did it.
Previously on a simple dictionary.
And also how can we apply it on a nested dictionary?
All right.
Right after the extraction of a value using a key we saw or how to create a new dictionary, which is
a copy of the existing one, how to delete a cell.
And also, we saw how we can add the new cell to the dictionary and how to remove all elements of the
dictionary.
So, all right.
So once we have this knowledge and we will finish the assignments, I can surely say that you guys dominate
dictionaries.
And I have to mention something.
Dictionaries is a very important topic because you can do a lot of stuff using it because you can do
endless nested cells inside.
You can build complete structures of data and you can use it in a lot of ways.
Whether you are a web developer or your automation developer is a very useful tool.
By the way, this tool is not a variable in this syntax.
On Java, for example, on Java, we have arrays and.
All right, so let's go over the assignments.
And also, as always, I tell you, first of all, try to resolve them by ourselves, OK?
All right.
So let's head over to the segments.
So first of all, please create a nested dictionary of building attendance.
The building has three apartments on two floors.
So first, by the way, I really recommend you before we begin, I really recommend you to use the attachment
file that is attached to the previous video where you have all the theory.
So just try to work with it.
Besides assignment number five, here you have all the material, all the theory that you need to resolve
these assignments so it can make your lives easier.
So first of all, once we want to create a nest, the dictionary, first of all, please create a parent
key, which is floor one and a parent key to a key tool, which is floor to write right after under
parent key one insert two nested cells.
First one will be first apartment where Rachel lives.
Obviously the structure hints us that this is the nested key and this is the nested value.
All right.
Uh, reminder again, same as we did in the previous video where we had Joey's kids.
All right.
So, all right.
After we had the second apartment and Jin lives in it, OK, so and under the parent key to insert the
nest itself of the third apartment where Jack lives.
All right.
Right after Brint all nested sale items of the first floor.
OK.
So access the first floor and print all the items in it.
And now the hint.
How can you drill down into a nested dictionary, uh, by using square brackets for the first level
and then square brackets again.
And here inside, you need to put some value add here to put some value.
Not going to tell you the answer, obviously.
Just a hint like that.
And here will be the dictionary.
So this is how you drill down, same as it did in the previous lecture.
So please print out all nested cells are all nested cell items of the first floor and right after,
please print out the resident in the second apartment.
All right.
I just want to have the name of the resident that lives in the second apartment.
Then after we have some changes in the building, the building owner managed to build an additional
apartment on the second floor.
So up until now, we had three apartments and now we have a fourth apartment.
All right.
So the new resident moved to the new fourth apartment.
Her name is Carol.
Add her to the dictionary.
So basically add a cell to the dictionary and you have the key there.
And.
All right, so you have the key there and you have the value.
And finally, we have, say, assignment number five, which is an advanced we didn't we did study all
the knowledge that you need in order to resolve it.
But we didn't see a straightforward example.
So you need to, uh, you know, to push harder on this assignment.
So the building owner decided to let his daughter in the first apartment so it would not be leased anymore,
deleted from the dictionary.
So this is the lease here represents attendants that are paying for lease and as the daughter of the
building owner and moves into the apartment.
So please remove the first apartment out of the dictionary.
And I also left you and here use the same method that used and the second assignment in order to delete
the exact value.
All right.
Because we learned how to do a simple pop in the previous video.
All right.
So in the previous video, we learned something like this.
But we don't want to put here first floor because then we're going to delete two apartments.
So think what you need to do in order to drill down into the exact apartment and delete only this one.
Oh, right.
So this will be about it, about the assignment's walk through.
Uh, good luck to you all and see you in the next lecture.