Python Program to Convert Two Lists Into a Dictionary (Using list comprehension)

bookmark

index = [1, 2, 3]
languages = ['python', 'c', 'c++']

dictionary = {k: v for k, v in zip(index, languages)}
print(dictionary)

 

Output

{1: 'python', 2: 'c', 3: 'c++'}