1 00:00:00,760 --> 00:00:06,710 In this session, we are discussing Pythonesque Dep't dictionary implementation. 2 00:00:06,970 --> 00:00:10,710 So how the dictionary can get nested, so see here. 3 00:00:11,260 --> 00:00:15,360 So in Python, in the dictionary is a dictionary inside and a dictionary. 4 00:00:15,760 --> 00:00:20,090 So it is a collection of dictionaries into one single dictionary. 5 00:00:20,440 --> 00:00:21,790 So just consider this one. 6 00:00:21,790 --> 00:00:22,830 We are having this people. 7 00:00:23,410 --> 00:00:30,160 So this people is having this is my key and this is a respected value and this value is out of the dictionary. 8 00:00:31,030 --> 00:00:36,400 This is one of the key colonies is a separate between quién value and this is one value and the value 9 00:00:36,400 --> 00:00:38,620 is itself is another dictionary. 10 00:00:38,800 --> 00:00:45,280 And you see where putting comma here and then three, these are respective value for the ZACKY and this 11 00:00:45,280 --> 00:00:46,230 is the respective value. 12 00:00:46,330 --> 00:00:49,170 And just consider that the inner dictionaries here. 13 00:00:49,360 --> 00:00:57,610 So name of Nivo and then aged twenty one six M and here we're have been named Titli each fourteen six 14 00:00:57,610 --> 00:01:02,340 F we're having this name Deeyah age 16 six. 15 00:01:02,350 --> 00:01:09,390 If many know we're having this name Adisa H 32 6F and married. 16 00:01:09,400 --> 00:01:09,790 Yes. 17 00:01:09,940 --> 00:01:14,340 So now this is a dictionary and there is the outer dictionary we are having. 18 00:01:14,500 --> 00:01:17,190 So that's why it is called Néstor Dictionary. 19 00:01:17,470 --> 00:01:22,960 So let us implement this one using python coding so that you can feel that how the outputs are coming 20 00:01:22,960 --> 00:01:25,890 and how to write the code appropriately. 21 00:01:26,680 --> 00:01:33,550 Now here will be declaring and defining are nested dictionary so people is equal to one kolon. 22 00:01:33,560 --> 00:01:39,880 So one is the key here and here we are having the value and the value is also having the key value pair. 23 00:01:40,240 --> 00:01:47,260 So again, we are having this, there is a key is two and this is of my value and value is another dictionary 24 00:01:47,260 --> 00:01:48,400 which is having the key value. 25 00:01:48,710 --> 00:01:51,180 So that's why it is called nested dictionary. 26 00:01:51,610 --> 00:01:55,270 So if you print, people will be getting the outcome like this one. 27 00:01:55,720 --> 00:01:58,900 So now we are trying to access elements of the dictionary. 28 00:01:59,050 --> 00:02:00,680 So print one. 29 00:02:00,700 --> 00:02:03,130 So one means the key will be one here. 30 00:02:03,460 --> 00:02:06,130 So now we're trying to retrieve from the value. 31 00:02:06,130 --> 00:02:08,980 We are trying to retrieve the value against the key NUM. 32 00:02:09,250 --> 00:02:12,610 So accordingly, we are getting this John here for the age. 33 00:02:12,610 --> 00:02:15,010 We are getting this 27 and 46. 34 00:02:15,010 --> 00:02:16,480 We are getting here, Mel. 35 00:02:16,660 --> 00:02:20,770 So in this way we can access elements of this nested dictionary. 36 00:02:21,550 --> 00:02:24,220 So next one we are going to define are the people. 37 00:02:24,220 --> 00:02:28,490 Three, that the key will be three and it is an empty dictionary here. 38 00:02:28,780 --> 00:02:31,170 So now adding elements to the dictionary. 39 00:02:31,180 --> 00:02:39,310 So people three name is LIUNA people 3h 24 people three six female and people three married. 40 00:02:39,310 --> 00:02:39,790 No. 41 00:02:40,090 --> 00:02:41,440 So now if we go on printing. 42 00:02:42,470 --> 00:02:47,460 They're already having this their respective party with the values that is key is one here. 43 00:02:47,480 --> 00:02:53,480 The key is to have the key is three are the respective nested dictionary we're observing here. 44 00:02:55,830 --> 00:03:02,070 Adding a dictionary to unaesthetic dictionary, so there is another way to add another dictionary, 45 00:03:02,080 --> 00:03:05,340 another entry in the dictionary, so people fought. 46 00:03:05,340 --> 00:03:09,780 So here for a key at the respective value will be the R the dictionary here. 47 00:03:10,050 --> 00:03:14,360 So if you go for this print people for getting this outcome like this one. 48 00:03:14,370 --> 00:03:17,460 So these of people there is a people thought is this one. 49 00:03:17,700 --> 00:03:24,150 But if I print the people then we're having the respective entry against the key one, against the key 50 00:03:24,150 --> 00:03:27,850 two, against the key three and against the key four here. 51 00:03:28,110 --> 00:03:36,090 So in this way, that nested dictionary is getting printed, not deleting deleting elements from onesta 52 00:03:36,090 --> 00:03:36,660 dictionary. 53 00:03:36,840 --> 00:03:43,950 So if we go for this print people, three print people fall so that Miski is given that three Packie 54 00:03:43,950 --> 00:03:45,150 is given as here. 55 00:03:45,480 --> 00:03:46,640 So now what will happen? 56 00:03:46,770 --> 00:03:53,100 I'll be getting the respective entry value against the key three and against the key for here. 57 00:03:53,520 --> 00:03:57,000 So now we are deleting people three married. 58 00:03:57,270 --> 00:03:58,790 So that means this married colon. 59 00:03:58,870 --> 00:03:59,370 Yes. 60 00:03:59,380 --> 00:04:01,290 This magical unknown and this married. 61 00:04:01,620 --> 00:04:02,010 Yes. 62 00:04:02,250 --> 00:04:06,330 They will get deleted if we execute this to set up statements. 63 00:04:06,510 --> 00:04:12,690 So now if we print these people three and people fall, we're getting them and this particular developer 64 00:04:12,990 --> 00:04:16,080 will be omitted because they have got deleted already. 65 00:04:16,320 --> 00:04:22,710 So there is a way to handle this about Néstor dictionary for the deletion of elements. 66 00:04:25,630 --> 00:04:28,880 Now, just consider this one, we're having another Néstor dictionary here. 67 00:04:29,470 --> 00:04:35,290 So in this particular Néstor dictionary, I'm just printing this people so you can find that this with 68 00:04:35,320 --> 00:04:40,630 an agency that you want the values that they're against Akito, against the three, against the for 69 00:04:40,630 --> 00:04:42,260 we're having the respective values there. 70 00:04:42,610 --> 00:04:47,490 So now we are going for this deal that is a deleting dictionary from the dictionary. 71 00:04:47,860 --> 00:04:49,390 So we are deleting this dictionary. 72 00:04:49,410 --> 00:04:51,310 There's a three and people four. 73 00:04:51,670 --> 00:04:57,460 In that case, if you go for the printing, the printing of this, people are getting this the dictionary 74 00:04:57,460 --> 00:04:58,560 entries against that. 75 00:04:58,570 --> 00:05:01,390 You've had one and against the key two here. 76 00:05:01,630 --> 00:05:06,010 So against the key three and four, the respective dictionary will be deleted. 77 00:05:07,940 --> 00:05:09,480 So now let us go for this. 78 00:05:10,040 --> 00:05:16,520 So at first I'm just printing here items so you see in the dictionary in the items you are getting this 79 00:05:16,520 --> 00:05:21,690 one as one this to this is another dictionary we're remaining with. 80 00:05:22,190 --> 00:05:30,230 So now we're using our for look, we're just writing this one that is for bid comma, painful in people 81 00:05:30,230 --> 00:05:31,010 that items. 82 00:05:31,160 --> 00:05:37,220 So bid will be initialized in the first iteration will be initiated by one and B info will be initialized 83 00:05:37,220 --> 00:05:38,800 with this respective dictionary. 84 00:05:39,320 --> 00:05:44,900 And in the second iteration bidding will be initialize with two and B info will be initialized with 85 00:05:44,900 --> 00:05:47,120 this nested in a dictionary here. 86 00:05:47,600 --> 00:05:52,550 So now we are printing this person IDBI so we are getting this one percent. 87 00:05:52,550 --> 00:05:55,790 It is getting printed as one percent is getting printed. 88 00:05:55,820 --> 00:05:57,620 That's due in the next iteration. 89 00:05:58,130 --> 00:06:04,970 So now to retrieve the respective values against the key in this inner nested dictionary, we are again 90 00:06:04,970 --> 00:06:08,420 using additive, although so far key in P info. 91 00:06:08,600 --> 00:06:15,290 We are printing this key, then concatenating with the colon and then we are printing this B in four 92 00:06:15,290 --> 00:06:15,880 key here. 93 00:06:16,040 --> 00:06:18,580 So we are getting this person in the colon one. 94 00:06:18,590 --> 00:06:24,320 So that is getting printed from here and within this look within this for loop, the printing name Colon 95 00:06:24,320 --> 00:06:28,460 John name H Colon 27 and six Colon Millhiser. 96 00:06:28,610 --> 00:06:30,560 So in this way that things are getting printed. 97 00:06:30,890 --> 00:06:34,160 So we're having this name, we are having this age, we're having sex. 98 00:06:34,410 --> 00:06:40,700 So there are three values have got picked up against their respective three keys from the inner nested 99 00:06:40,700 --> 00:06:41,300 dictionary. 100 00:06:41,570 --> 00:06:47,360 And in the next iteration, we are removing the values, key value peers accordingly in this nested 101 00:06:47,360 --> 00:06:47,780 volume. 102 00:06:48,230 --> 00:06:54,230 So in this way, in this particular discussion, we have and discussed that how to handle with the nested 103 00:06:54,230 --> 00:07:00,060 dictionaries and how to tackle it with the key and the value pairs according to our equipment. 104 00:07:00,470 --> 00:07:01,640 Thanks for watching this video.