1 00:00:00,690 --> 00:00:01,550 Hello and welcome. 2 00:00:01,560 --> 00:00:12,180 In this that show we are going to learn how to remove items from a dictionary list you can remove an 3 00:00:12,300 --> 00:00:20,050 item from a dictionary list by using the removed method or. 4 00:00:20,210 --> 00:00:21,490 And you can use that. 5 00:00:21,570 --> 00:00:31,980 You can do it using its key which is the fastest and the most efficient or you can use the removed method 6 00:00:32,460 --> 00:00:37,560 by using the value when you use the value. 7 00:00:37,590 --> 00:00:41,520 The process can be slow and inefficient. 8 00:00:43,680 --> 00:00:52,260 So when you use the remove method you use that with the key and you use the key function to remove function 9 00:00:52,260 --> 00:00:56,670 with the key of the dictionary item. 10 00:00:56,670 --> 00:00:59,820 That is the most efficient way. 11 00:00:59,820 --> 00:01:01,170 So let me illustrate that. 12 00:01:01,170 --> 00:01:06,210 So I'm just going to come down here and I'll type the name of the dictionary 13 00:01:09,150 --> 00:01:22,230 which is a form book and what I'll do how add the remove function which is remove remove method. 14 00:01:22,270 --> 00:01:34,180 So form book dot remove and inside the parentheses are passing the key which is the name Jessica 15 00:01:37,610 --> 00:01:39,870 OK so past and the key. 16 00:01:42,200 --> 00:01:48,570 So that should remove Jessica from the dictionary list. 17 00:01:48,830 --> 00:01:57,260 If I now do a count on this dictionary it should show only one item in the list. 18 00:01:57,260 --> 00:01:59,780 So let's do a count on that. 19 00:01:59,780 --> 00:02:09,050 So I'm going to consult the right line to a phonebook on our remove the name Alex 20 00:02:12,890 --> 00:02:15,800 and I do a phonebook dot count 21 00:02:23,060 --> 00:02:30,980 and I'll remove the question marks and remove the square brackets. 22 00:02:31,730 --> 00:02:39,230 OK so what they should do if I execute this code now it will show me a dictionary. 23 00:02:39,230 --> 00:02:46,460 How many items are in the dictionary list so I expected to show just the one since I have removed Jessica 24 00:02:46,640 --> 00:02:48,920 from the phone book list. 25 00:02:49,070 --> 00:02:53,240 So let's click on the start to run the application. 26 00:02:54,170 --> 00:03:03,530 As I've said in notice it displayed a list count of one illustrating that we've only got one item in 27 00:03:03,530 --> 00:03:06,040 our dictionary list. 28 00:03:06,110 --> 00:03:06,520 All right. 29 00:03:06,540 --> 00:03:12,950 So that's the easiest way to remove if you want to add you do it the way I've done here phonebook dot 30 00:03:13,010 --> 00:03:18,170 ad and you pass in the key and then the value. 31 00:03:19,580 --> 00:03:28,240 So that's it for this lecture in this lecture we learned how to remove an item from a dictionary list. 32 00:03:28,370 --> 00:03:29,600 Thank you for watching. 33 00:03:29,600 --> 00:03:30,340 Bye for now.