Modifying and Adding Key-Value Pairs
To
modify or
add a key-value pair in the dictionary, we use direct assignment – the structure is
mutable:
DETAILS
We created a dictionary that contains two key-value pairs.
Then, we added a new one consisting of the key "
big" and the associated value, "
small".
Finally, we modified the value of that key with a new one,
like an update, for the sake of example - "
tiny".
Proceed to the next page.