Dictionary
A dictionary in Python is a one to one mapping.
Every key points to a value, separated by a colon (:).
A dictionary is defined using curly brackets. The value left of the colon is called the key, the value right of the colon is called the value. Every (key,value) pair is separated by a comma.
Related Courses
python dictionary
The example below creates a dictionary. Keys must be unique values, you can not use the same key twice. Values may or may not be unique.
k = { 'EN':'English', 'FR':'French' } |
We defined a dictionary named k and access elements using the square brackets you’ve seen before. We use the key [‘EN’] to print the value ‘English’.

python dictionary append
To add a new value to a dictionary you can simply assign a key value pair:
k['DE'] = 'German' |
dictionary remove
To remove a key/value pair use the del keyword:
k = { 'EN':'English', 'FR':'French' } |