Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to Add Elements to a dictionary using the update() method

myDictionary = {
    "first": "A",
    "second": "B",
    "third": "C",
}
myDictionary.update({"fourth": "D"})
print(myDictionary)
# Output:
# {'first': 'A', 'second': 'B', 'third': 'C', 'fourth': 'D'}
Source by liu-111.medium.com #
 
PREVIOUS NEXT
Tagged: #How #Add #Elements #dictionary #method
ADD COMMENT
Topic
Name
2+4 =