0

help me please In Python. How to make the elements of the first list be the keys, and the elements of the second list the values ​​of the dictionary

keys = []  # first list


values = [] # second list


dictionary = {} # our dict
Str1ke
  • 3
  • 2

1 Answers1

1

The easiest way to do this is with zip(), then create the dict from a list of tuples:

dictionary = dict(zip(keys, values))
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268