-1

I have two lists :

list1 = ['a', 'b', 'c', 'd', 'e']
list2 = [10, 20, 30, 40, 50]

I want to assign list2 values to list1 variables. Simply put forward I want end result like this :

final_list = ['a' = 10, 'b' = 20, 'c' = 30, 'd' = 40, 'e' = 50]

What is the way to do in python3?

Vikas Gupta
  • 10,779
  • 4
  • 35
  • 42

1 Answers1

1

You can use zip

list1 = ['a', 'b', 'c', 'd', 'e']
list2 = [10, 20, 30, 40, 50]
res = dict(zip(list1,list2))

Output :

{'a': 10, 'c': 30, 'b': 20, 'e': 50, 'd': 40}
khelili miliana
  • 3,730
  • 2
  • 15
  • 28