Hello and welcome.
In this that show we are going to learn how to remove items from a dictionary list you can remove an
item from a dictionary list by using the removed method or.
And you can use that.
You can do it using its key which is the fastest and the most efficient or you can use the removed method
by using the value when you use the value.
The process can be slow and inefficient.
So when you use the remove method you use that with the key and you use the key function to remove function
with the key of the dictionary item.
That is the most efficient way.
So let me illustrate that.
So I'm just going to come down here and I'll type the name of the dictionary
which is a form book and what I'll do how add the remove function which is remove remove method.
So form book dot remove and inside the parentheses are passing the key which is the name Jessica
OK so past and the key.
So that should remove Jessica from the dictionary list.
If I now do a count on this dictionary it should show only one item in the list.
So let's do a count on that.
So I'm going to consult the right line to a phonebook on our remove the name Alex
and I do a phonebook dot count
and I'll remove the question marks and remove the square brackets.
OK so what they should do if I execute this code now it will show me a dictionary.
How many items are in the dictionary list so I expected to show just the one since I have removed Jessica
from the phone book list.
So let's click on the start to run the application.
As I've said in notice it displayed a list count of one illustrating that we've only got one item in
our dictionary list.
All right.
So that's the easiest way to remove if you want to add you do it the way I've done here phonebook dot
ad and you pass in the key and then the value.
So that's it for this lecture in this lecture we learned how to remove an item from a dictionary list.
Thank you for watching.
Bye for now.