Q:

Write a Python program to join two given list of lists of same length, element wise

0

Write a Python program to join two given list of lists of same length, element wise

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def elementswise_join(l1, l2):
    result = [x + y for x, y in zip(l1, l2)]
    return result

nums1 = [[10,20], [30,40], [50,60], [30,20,80]]
nums2 = [[61], [12,14,15], [12,13,19,20], [12]]
print("Original lists:")
print(nums1)
print(nums2)
print("\nJoin the said two lists element wise:")
print(elementswise_join(nums1, nums2))

list1 = [['a','b'], ['b','c','d'], ['e', 'f']]
list2 = [['p','q'], ['p','s','t'], ['u','v','w']]
print("\nOriginal lists:")
print(list1)
print(list2)
print("\nJoin the said two lists element wise:")
print(elementswise_join(list1, list2))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now