1 00:00:12,190 --> 00:00:13,660 Hello and welcome. 2 00:00:14,530 --> 00:00:22,600 In this video, we will talk about the assignments of dictionary, the advanced level, and before that, 3 00:00:22,600 --> 00:00:27,300 let's have a quick review of the last lectures topics. 4 00:00:27,820 --> 00:00:34,930 So, first of all, we've studied some complex topic which is nested dictionaries. 5 00:00:35,140 --> 00:00:40,980 And there we saw basically that we have two types of cells. 6 00:00:41,290 --> 00:00:47,260 We have a parent cell, which is what we have in a simple dictionary. 7 00:00:47,260 --> 00:00:48,930 We have a cell in the cell. 8 00:00:48,940 --> 00:00:50,200 We have key and value. 9 00:00:51,550 --> 00:00:57,580 And also we have this thing called a child cell or a nested cell. 10 00:00:57,880 --> 00:01:04,270 And basically what that means is that we have a key on the left side and on the right side. 11 00:01:04,270 --> 00:01:13,230 Instead of having only a value, a simple one value, we have a nested cell which also contains another 12 00:01:13,240 --> 00:01:15,020 another key and another value. 13 00:01:15,670 --> 00:01:23,740 So this is the nested dictionaries that we've been over and we saw examples as well. 14 00:01:25,250 --> 00:01:34,520 Right after we went to, we started to discuss of manipulations that we can apply upon dictionaries 15 00:01:34,910 --> 00:01:42,620 and same as we did, unless we saw here, several things were to be that we can do upon a dictionary. 16 00:01:43,340 --> 00:01:48,670 First of all, we saw how can we extract a value by using the key? 17 00:01:49,010 --> 00:01:53,060 And we saw a comparison of how we did it. 18 00:01:53,330 --> 00:01:55,670 Previously on a simple dictionary. 19 00:01:55,850 --> 00:01:58,910 And also how can we apply it on a nested dictionary? 20 00:02:00,410 --> 00:02:01,040 All right. 21 00:02:02,270 --> 00:02:12,230 Right after the extraction of a value using a key we saw or how to create a new dictionary, which is 22 00:02:12,230 --> 00:02:15,630 a copy of the existing one, how to delete a cell. 23 00:02:15,920 --> 00:02:22,670 And also, we saw how we can add the new cell to the dictionary and how to remove all elements of the 24 00:02:22,670 --> 00:02:23,270 dictionary. 25 00:02:23,870 --> 00:02:25,550 So, all right. 26 00:02:25,550 --> 00:02:34,490 So once we have this knowledge and we will finish the assignments, I can surely say that you guys dominate 27 00:02:34,490 --> 00:02:35,390 dictionaries. 28 00:02:35,630 --> 00:02:37,880 And I have to mention something. 29 00:02:38,240 --> 00:02:46,040 Dictionaries is a very important topic because you can do a lot of stuff using it because you can do 30 00:02:46,040 --> 00:02:48,590 endless nested cells inside. 31 00:02:48,800 --> 00:02:56,330 You can build complete structures of data and you can use it in a lot of ways. 32 00:02:56,600 --> 00:03:02,360 Whether you are a web developer or your automation developer is a very useful tool. 33 00:03:02,720 --> 00:03:07,850 By the way, this tool is not a variable in this syntax. 34 00:03:08,000 --> 00:03:13,880 On Java, for example, on Java, we have arrays and. 35 00:03:14,060 --> 00:03:17,600 All right, so let's go over the assignments. 36 00:03:18,610 --> 00:03:25,380 And also, as always, I tell you, first of all, try to resolve them by ourselves, OK? 37 00:03:26,350 --> 00:03:26,760 All right. 38 00:03:26,770 --> 00:03:29,250 So let's head over to the segments. 39 00:03:29,270 --> 00:03:33,800 So first of all, please create a nested dictionary of building attendance. 40 00:03:34,460 --> 00:03:38,300 The building has three apartments on two floors. 41 00:03:39,140 --> 00:03:46,010 So first, by the way, I really recommend you before we begin, I really recommend you to use the attachment 42 00:03:46,010 --> 00:03:50,420 file that is attached to the previous video where you have all the theory. 43 00:03:50,720 --> 00:03:52,250 So just try to work with it. 44 00:03:53,210 --> 00:03:59,570 Besides assignment number five, here you have all the material, all the theory that you need to resolve 45 00:04:00,410 --> 00:04:04,040 these assignments so it can make your lives easier. 46 00:04:04,640 --> 00:04:11,180 So first of all, once we want to create a nest, the dictionary, first of all, please create a parent 47 00:04:11,180 --> 00:04:22,280 key, which is floor one and a parent key to a key tool, which is floor to write right after under 48 00:04:22,280 --> 00:04:25,910 parent key one insert two nested cells. 49 00:04:26,390 --> 00:04:30,320 First one will be first apartment where Rachel lives. 50 00:04:30,620 --> 00:04:36,840 Obviously the structure hints us that this is the nested key and this is the nested value. 51 00:04:37,310 --> 00:04:37,910 All right. 52 00:04:38,200 --> 00:04:44,960 Uh, reminder again, same as we did in the previous video where we had Joey's kids. 53 00:04:45,410 --> 00:04:45,940 All right. 54 00:04:46,550 --> 00:04:47,630 So, all right. 55 00:04:47,630 --> 00:04:56,330 After we had the second apartment and Jin lives in it, OK, so and under the parent key to insert the 56 00:04:56,330 --> 00:04:59,480 nest itself of the third apartment where Jack lives. 57 00:05:00,560 --> 00:05:01,080 All right. 58 00:05:01,280 --> 00:05:07,440 Right after Brint all nested sale items of the first floor. 59 00:05:07,820 --> 00:05:08,280 OK. 60 00:05:08,300 --> 00:05:13,910 So access the first floor and print all the items in it. 61 00:05:16,340 --> 00:05:17,510 And now the hint. 62 00:05:17,780 --> 00:05:26,900 How can you drill down into a nested dictionary, uh, by using square brackets for the first level 63 00:05:26,900 --> 00:05:28,660 and then square brackets again. 64 00:05:28,910 --> 00:05:34,820 And here inside, you need to put some value add here to put some value. 65 00:05:35,870 --> 00:05:37,610 Not going to tell you the answer, obviously. 66 00:05:37,610 --> 00:05:40,100 Just a hint like that. 67 00:05:41,710 --> 00:05:43,370 And here will be the dictionary. 68 00:05:43,390 --> 00:05:46,340 So this is how you drill down, same as it did in the previous lecture. 69 00:05:47,140 --> 00:05:55,190 So please print out all nested cells are all nested cell items of the first floor and right after, 70 00:05:55,210 --> 00:05:58,720 please print out the resident in the second apartment. 71 00:05:58,750 --> 00:05:59,020 All right. 72 00:05:59,020 --> 00:06:03,950 I just want to have the name of the resident that lives in the second apartment. 73 00:06:05,260 --> 00:06:11,140 Then after we have some changes in the building, the building owner managed to build an additional 74 00:06:11,140 --> 00:06:12,920 apartment on the second floor. 75 00:06:13,720 --> 00:06:17,590 So up until now, we had three apartments and now we have a fourth apartment. 76 00:06:18,310 --> 00:06:18,730 All right. 77 00:06:18,730 --> 00:06:23,770 So the new resident moved to the new fourth apartment. 78 00:06:24,190 --> 00:06:25,570 Her name is Carol. 79 00:06:25,570 --> 00:06:27,010 Add her to the dictionary. 80 00:06:27,400 --> 00:06:34,560 So basically add a cell to the dictionary and you have the key there. 81 00:06:35,290 --> 00:06:36,280 And. 82 00:06:36,520 --> 00:06:39,790 All right, so you have the key there and you have the value. 83 00:06:41,110 --> 00:06:49,330 And finally, we have, say, assignment number five, which is an advanced we didn't we did study all 84 00:06:49,330 --> 00:06:51,820 the knowledge that you need in order to resolve it. 85 00:06:52,000 --> 00:06:54,790 But we didn't see a straightforward example. 86 00:06:54,790 --> 00:06:59,680 So you need to, uh, you know, to push harder on this assignment. 87 00:07:00,610 --> 00:07:09,010 So the building owner decided to let his daughter in the first apartment so it would not be leased anymore, 88 00:07:09,310 --> 00:07:11,450 deleted from the dictionary. 89 00:07:11,800 --> 00:07:22,330 So this is the lease here represents attendants that are paying for lease and as the daughter of the 90 00:07:22,330 --> 00:07:24,750 building owner and moves into the apartment. 91 00:07:24,760 --> 00:07:28,290 So please remove the first apartment out of the dictionary. 92 00:07:28,750 --> 00:07:36,730 And I also left you and here use the same method that used and the second assignment in order to delete 93 00:07:36,760 --> 00:07:38,050 the exact value. 94 00:07:38,410 --> 00:07:38,880 All right. 95 00:07:38,890 --> 00:07:44,620 Because we learned how to do a simple pop in the previous video. 96 00:07:44,740 --> 00:07:45,250 All right. 97 00:07:45,260 --> 00:07:49,180 So in the previous video, we learned something like this. 98 00:07:50,200 --> 00:07:57,870 But we don't want to put here first floor because then we're going to delete two apartments. 99 00:07:58,330 --> 00:08:05,350 So think what you need to do in order to drill down into the exact apartment and delete only this one. 100 00:08:06,280 --> 00:08:06,970 Oh, right. 101 00:08:07,000 --> 00:08:12,310 So this will be about it, about the assignment's walk through. 102 00:08:12,580 --> 00:08:16,090 Uh, good luck to you all and see you in the next lecture.