Dictionary OperationsΒΆ
The del
statement removes a key-value pair from a dictionary.
Dictionaries are also mutable.
Similarily, a new shipment of 200 bananas arriving could be handled like this.
Notice that there are now 512 bananas—the dictionary has been modified. Note also that the len
function also works on dictionaries. It returns the number
of key-value pairs: