2

Below is the given sample lists

words = ["PoGo","Spange","Lie-Fi"]

definitions = ["Slang for Pokemon Go","To collect spare change, either from couches, passerbys on the street or any numerous other ways and means","When your phone or tablet indicates that you are connected to a wireless network, however you are still unable to load webpages or use any internet services with your device"] 

2 Answers2

3

Try this:

cooldictionary = {a : b for (a,b) in zip(words, definitions)}

By thanks @Danimesejo you can try this:

cooldictionary = dict(zip(words, definitions))
I'mahdi
  • 23,382
  • 5
  • 22
  • 30
0

Below is the code which is implemented.

words = ["PoGo","Spange","Lie-Fi"]

definitions = ["Slang for Pokemon Go","To collect spare change, either from couches, passerbys on the street or any numerous other ways and means","When your phone or tablet indicates that you are connected to a wireless network, however you are still unable to load webpages or use any internet services with your device"] 

cooldictionary = {}
for word in words:
    for definition in definitions:
        cooldictionary[word] = definition
        definitions.remove(definition)
        break
    
print(cooldictionary)

Explanation:

In the above code we have created a dictionary named cooldictionary which searches for each elements in a words dictionary and definitions dictionary and matches them in the form of key and value pair one by one for each index and removing them with every iteration untill the elements end and then it breaks the loop and print it finally.