Python Adding Items in a Dictionary
Adding Items in a Dictionary
Adding an item to the dictionary is done by using a new index key and assigning a value to it:
Example
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["color"] = "red"
print(thisdict)
Try it Yourself »
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.