0

I have two lists:

names = ["Person1", "Person2", "Person3"]

jobs = ["It", "Worker", "Kid"]

I want to make dictionary with zip function

mydict = {key if key == "Person2" else "Something": value for key, value in zip(names, jobs)}
print(mydict)

As the result it prints:

{'Something': 'Kid', 'Person2': 'Worker'}

I would expect this:

{'Something': 'It', 'Person2': 'Worker', 'Something':'Kid'}

Why do I get other result? Please help me.

Jorge Luis
  • 813
  • 6
  • 21
Den
  • 1
  • 1

0 Answers0