Write a program that combines the lists to a dictionary?
Answers
Answered by
0
Python Exercise: Map two lists into a dictionary.
Write a Python program to map two lists into a dictionary.
Sample Solution:-
Python Code:
keys = ['red', 'green', 'blue'] values = ['#FF0000','#008000', '#0000FF'] color_dictionary = dict(zip(keys, values)) print(color_dictionary)
Sample Output:
{'green': '#008000', 'blue': '#0000FF', 'red': '#FF0000'}
Shashank1811:
is this helpful to u??
Answered by
0
keys = ['red', 'green', 'blue']
values = ['#FF0000','#008000', '#0000FF']
color_dictionary = dict(zip(keys, values))
print(color_dictionary)
Sample Output:
{'green': '#008000', 'blue': '#0000FF', 'red': '#FF0000'}
Python Code Editor:
Similar questions