SyntaxFix
Write A Post
Hire A Developer
Questions
dicts = {} keys = range(4) values = ["Hi", "I", "am", "John"] for i in keys: dicts[i] = values[i] print(dicts)
alternatively
In [7]: dict(list(enumerate(values))) Out[7]: {0: 'Hi', 1: 'I', 2: 'am', 3: 'John'}