my_dict = {
"first_name": "John",
"last_name": "Deo",
"occupation": "programmer"
}
print(my_dict["first_name"]) #print first_name value of dictionary
print(my_dict.get("first_name")) #same as above
my_dict["first_name"] = "Josef" #To change first_name value
my_dict.values() #return values of dictionary
my_dict["nick_name"] = "JDo" #To add key value to dictionary
my_dict.pop("last_name") #To remove a key value pair from dictionary based on key
del my_dict["last_name"] #Same as above
my_dict.clear() #empty a dictionary
my_dict.copy() #To copy a dictionary
Dictionaries in python represent a key-value pair datastore in a variable. You can access the value of the dictionary item by its key name. You can also change and remove items from a dictionary using a key name.
You can also create dictionaries in python using dict constructor. Here is the example