Answers for "python map two lists"

23

dictionary from two lists

>>> keys = ['a', 'b', 'c']
>>> values = [1, 2, 3]
>>> dictionary = dict(zip(keys, values))
>>> print(dictionary)
{'a': 1, 'b': 2, 'c': 3}
Posted by: Guest on May-21-2020
0

adding two lists using lambda function

listA=['one', 'two' , 'three']
listB=['apple','cherry','watermelon']
list(map(lambda x, y: x+ ' ' +y, listA, listB))
Posted by: Guest on June-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language