Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add an item to a dictionary python

a_dictionary = {} #creates a blank dictionary
#variables created outside of dictionary
name = "Geronimo" #this will become a key to access the value
age = 34 #This becomes the value assigned to the key

a_dictionary[name] = bid #this adds the key and the value
Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #add #item #dictionary #python
ADD COMMENT
Topic
Name
1+6 =