1 00:00:12,650 --> 00:00:19,680 Hello, in this video, we'll go over the assignments of dictionary practice basic and let's begin. 2 00:00:19,700 --> 00:00:21,830 Let's go over the assignments quickly. 3 00:00:22,520 --> 00:00:22,850 All right. 4 00:00:22,860 --> 00:00:26,300 So first of all, please create a dictionary about Alex. 5 00:00:26,330 --> 00:00:27,980 Alex is 32 years old. 6 00:00:28,010 --> 00:00:36,380 He's married and he has three kids up towards his extract, all values of dictionary, and assign them 7 00:00:36,380 --> 00:00:38,120 into simple variables. 8 00:00:38,600 --> 00:00:46,120 And please choose variable time according to values type of input, meaning like values here. 9 00:00:46,220 --> 00:00:49,790 I'm not going to say which ones are strengths, which ones are integers. 10 00:00:50,100 --> 00:00:55,680 Uh, if you came until this point, you probably know, uh, which one is who. 11 00:00:56,030 --> 00:01:02,540 So just create three variables and assign them assign the values as we did and the previous video. 12 00:01:03,680 --> 00:01:04,250 All right. 13 00:01:04,640 --> 00:01:08,390 Uh, now we have assignment number three, which is a challenge. 14 00:01:08,660 --> 00:01:12,050 And it's also a search Google assignment. 15 00:01:12,320 --> 00:01:18,890 As I always mention, once you become automation developers, you will have to use Google as your best 16 00:01:18,890 --> 00:01:19,340 friend. 17 00:01:19,550 --> 00:01:22,840 And each time you don't know something, you will go there to look for it. 18 00:01:23,090 --> 00:01:31,040 So I will help you with this challenging assignment and also recommended you to search and Google with 19 00:01:31,040 --> 00:01:34,550 this phrase python update value of dictionary. 20 00:01:35,060 --> 00:01:38,030 And we will go over and do it right now. 21 00:01:38,310 --> 00:01:41,180 And as you can see, I already search for it. 22 00:01:41,570 --> 00:01:42,130 All right. 23 00:01:42,500 --> 00:01:43,430 So it's right here. 24 00:01:43,730 --> 00:01:52,010 And let's head over for the first website w w w that program, News.com, uh, seems like a decent website, 25 00:01:52,820 --> 00:01:54,440 which I use from time to time. 26 00:01:56,930 --> 00:02:05,750 So once we go here, you see here the syntax of update, there is like an action called update and you 27 00:02:05,750 --> 00:02:14,060 put a dictionary inside so you see your square brackets inside the update, meaning inside the square 28 00:02:14,180 --> 00:02:14,710 brackets. 29 00:02:14,720 --> 00:02:17,640 We can only have a dictionary item. 30 00:02:17,660 --> 00:02:17,930 All right. 31 00:02:17,930 --> 00:02:19,150 But it says other here. 32 00:02:19,720 --> 00:02:20,350 Hmm. 33 00:02:20,900 --> 00:02:21,500 All right. 34 00:02:21,620 --> 00:02:25,920 Let's go a little further and let's head out for an example. 35 00:02:26,870 --> 00:02:33,650 OK, so we have two dictionaries here, Dictionary D, which has the key one and the value one in string. 36 00:02:34,490 --> 00:02:37,940 And then it has the key to and it has the value three. 37 00:02:37,950 --> 00:02:40,550 So this is basically an error, I guess. 38 00:02:42,260 --> 00:02:50,440 So afterwards we have another dictionary called Daewon and we have a key of two and value of two. 39 00:02:50,630 --> 00:02:57,560 So I assume that this is the correct key and value and let's see what they're doing here. 40 00:02:57,860 --> 00:03:07,400 They're taking the first dictionary, which is this one taking it and then placing here, placing him 41 00:03:07,400 --> 00:03:08,390 with that update. 42 00:03:08,690 --> 00:03:09,140 Yeah. 43 00:03:09,440 --> 00:03:13,120 And then they're just placing the name of the second dictionary. 44 00:03:14,060 --> 00:03:18,330 So I assume that once we print it. 45 00:03:19,010 --> 00:03:19,690 All right. 46 00:03:20,180 --> 00:03:28,390 So the place of key to like the key and value here is two and two. 47 00:03:28,670 --> 00:03:36,920 So this item will replace replace this item because there are matching and also this value would replace 48 00:03:36,950 --> 00:03:37,680 this value. 49 00:03:37,940 --> 00:03:42,700 So this way we could update a value inside a dictionary. 50 00:03:43,310 --> 00:03:44,470 Let's see the output. 51 00:03:44,570 --> 00:03:51,120 So we have here we have here one and then we have key to add value to. 52 00:03:51,440 --> 00:03:52,650 So this is the first print. 53 00:03:52,670 --> 00:03:54,820 So this is exactly what they did here. 54 00:03:55,130 --> 00:03:57,800 They took this dictionary, all right. 55 00:03:57,980 --> 00:04:04,270 They placed it here inside the dart update and they did it upon the first dictionary. 56 00:04:04,280 --> 00:04:13,190 So they basically updated the dictionary with these key and value in the placement where you can see 57 00:04:13,190 --> 00:04:14,210 the same key. 58 00:04:15,260 --> 00:04:21,800 OK, by the way, all the right, for this example, are reserved to programming's dot com. 59 00:04:22,730 --> 00:04:25,340 OK, so we have a clue how to update it. 60 00:04:25,760 --> 00:04:30,160 And also, if you get into trouble, scroll down to the beach. 61 00:04:30,170 --> 00:04:32,950 Two of this document there, you will find the answer. 62 00:04:32,960 --> 00:04:36,820 But don't be tempted to do it really fast. 63 00:04:36,830 --> 00:04:44,210 Just try to resolve it by yourself and try to fight with the code and try to make your results come 64 00:04:44,210 --> 00:04:45,050 from you first. 65 00:04:45,050 --> 00:04:48,230 Only if you get stuck, go there and see the resolution. 66 00:04:48,830 --> 00:04:49,370 All right. 67 00:04:50,210 --> 00:04:53,450 So it's not actually the resolution is the way of solving it. 68 00:04:54,350 --> 00:04:54,920 All right. 69 00:04:55,260 --> 00:05:01,430 So the first the fourth assignment says Alex had a birthday and not. 70 00:05:04,240 --> 00:05:11,740 Now, yeah, now is 33 day the value that belongs to the key age. 71 00:05:12,010 --> 00:05:22,290 So basically update this cell of age, updated to 33, applying what we learned and saw it right here. 72 00:05:23,860 --> 00:05:30,970 And once Alex became 33, a little girl joins his family, update the kids key value into four. 73 00:05:31,210 --> 00:05:37,240 So this is the same as we did an assignment number four and last two assignments. 74 00:05:37,240 --> 00:05:44,020 Just print out the value of the dictionary, the values of the dictionary, and then print out the keys 75 00:05:44,020 --> 00:05:44,800 of the dictionary. 76 00:05:45,580 --> 00:05:47,370 OK, so that's about it. 77 00:05:47,380 --> 00:05:54,100 I wish you good luck resolving these assignments and I will see you in the next video with these assignments 78 00:05:54,100 --> 00:05:54,730 resolution. 79 00:05:54,940 --> 00:05:55,390 Thank you.