Lesson 2: Add, update, delete
A dictionary isn't fixed — you can add new keys, update existing values, and delete pairs. It all goes through the key: assigning to a new key adds, assigning to an existing key updates, and del removes.
Like a bulletin board with notes. You can pin a new note (add), swap an existing one (update), or tear one off (delete).
- assignment
- Giving a value to a key using the equals sign.
- del
- A statement that removes a key-value pair from the dictionary.
- update
- Replacing the value of a key that already exists.