In this session, we are discussing Pythonesque Dep't dictionary implementation.
So how the dictionary can get nested, so see here.
So in Python, in the dictionary is a dictionary inside and a dictionary.
So it is a collection of dictionaries into one single dictionary.
So just consider this one.
We are having this people.
So this people is having this is my key and this is a respected value and this value is out of the dictionary.
This is one of the key colonies is a separate between quién value and this is one value and the value
is itself is another dictionary.
And you see where putting comma here and then three, these are respective value for the ZACKY and this
is the respective value.
And just consider that the inner dictionaries here.
So name of Nivo and then aged twenty one six M and here we're have been named Titli each fourteen six
F we're having this name Deeyah age 16 six.
If many know we're having this name Adisa H 32 6F and married.
Yes.
So now this is a dictionary and there is the outer dictionary we are having.
So that's why it is called Néstor Dictionary.
So let us implement this one using python coding so that you can feel that how the outputs are coming
and how to write the code appropriately.
Now here will be declaring and defining are nested dictionary so people is equal to one kolon.
So one is the key here and here we are having the value and the value is also having the key value pair.
So again, we are having this, there is a key is two and this is of my value and value is another dictionary
which is having the key value.
So that's why it is called nested dictionary.
So if you print, people will be getting the outcome like this one.
So now we are trying to access elements of the dictionary.
So print one.
So one means the key will be one here.
So now we're trying to retrieve from the value.
We are trying to retrieve the value against the key NUM.
So accordingly, we are getting this John here for the age.
We are getting this 27 and 46.
We are getting here, Mel.
So in this way we can access elements of this nested dictionary.
So next one we are going to define are the people.
Three, that the key will be three and it is an empty dictionary here.
So now adding elements to the dictionary.
So people three name is LIUNA people 3h 24 people three six female and people three married.
No.
So now if we go on printing.
They're already having this their respective party with the values that is key is one here.
The key is to have the key is three are the respective nested dictionary we're observing here.
Adding a dictionary to unaesthetic dictionary, so there is another way to add another dictionary,
another entry in the dictionary, so people fought.
So here for a key at the respective value will be the R the dictionary here.
So if you go for this print people for getting this outcome like this one.
So these of people there is a people thought is this one.
But if I print the people then we're having the respective entry against the key one, against the key
two, against the key three and against the key four here.
So in this way, that nested dictionary is getting printed, not deleting deleting elements from onesta
dictionary.
So if we go for this print people, three print people fall so that Miski is given that three Packie
is given as here.
So now what will happen?
I'll be getting the respective entry value against the key three and against the key for here.
So now we are deleting people three married.
So that means this married colon.
Yes.
This magical unknown and this married.
Yes.
They will get deleted if we execute this to set up statements.
So now if we print these people three and people fall, we're getting them and this particular developer
will be omitted because they have got deleted already.
So there is a way to handle this about Néstor dictionary for the deletion of elements.
Now, just consider this one, we're having another Néstor dictionary here.
So in this particular Néstor dictionary, I'm just printing this people so you can find that this with
an agency that you want the values that they're against Akito, against the three, against the for
we're having the respective values there.
So now we are going for this deal that is a deleting dictionary from the dictionary.
So we are deleting this dictionary.
There's a three and people four.
In that case, if you go for the printing, the printing of this, people are getting this the dictionary
entries against that.
You've had one and against the key two here.
So against the key three and four, the respective dictionary will be deleted.
So now let us go for this.
So at first I'm just printing here items so you see in the dictionary in the items you are getting this
one as one this to this is another dictionary we're remaining with.
So now we're using our for look, we're just writing this one that is for bid comma, painful in people
that items.
So bid will be initialized in the first iteration will be initiated by one and B info will be initialized
with this respective dictionary.
And in the second iteration bidding will be initialize with two and B info will be initialized with
this nested in a dictionary here.
So now we are printing this person IDBI so we are getting this one percent.
It is getting printed as one percent is getting printed.
That's due in the next iteration.
So now to retrieve the respective values against the key in this inner nested dictionary, we are again
using additive, although so far key in P info.
We are printing this key, then concatenating with the colon and then we are printing this B in four
key here.
So we are getting this person in the colon one.
So that is getting printed from here and within this look within this for loop, the printing name Colon
John name H Colon 27 and six Colon Millhiser.
So in this way that things are getting printed.
So we're having this name, we are having this age, we're having sex.
So there are three values have got picked up against their respective three keys from the inner nested
dictionary.
And in the next iteration, we are removing the values, key value peers accordingly in this nested
volume.
So in this way, in this particular discussion, we have and discussed that how to handle with the nested
dictionaries and how to tackle it with the key and the value pairs according to our equipment.
Thanks for watching this video.