Comprehensions List and Dict Question PDF
Comprehensions List and Dict Question PDF
# 22. Convert two lists ['a', 'b', 'c'] and [1, 2, 3] into a
dictionary using a dictionary comprehension.
keys = ['a', 'b', 'c']
values = [1, 2, 3]
converted_dict = {keys[i]: values[i] for i in
range(len(keys))}
print("Converted lists into dictionary:", converted_dict)