Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to create a dictionary in python

keys = ['a', 'b', 'c']

values = [1, 2, 3]

def create_dictionary(keys, values):
    result = {} # empty dictionary
    for key, value in zip(keys, values):
        result[key] = value
    return result
Source by flexiple.com #
 
PREVIOUS NEXT
Tagged: #create #dictionary #python
ADD COMMENT
Topic
Name
2+7 =