Q:

Concatenate two lists in the following order using python programming

belongs to collection: Python List Exercises

-1

Concatenate two lists in the following order

list1 = ["Hello ", "take "]
list2 = ["Dear", "Sir"]

Expected output:

['Hello Dear', 'Hello Sir', 'take Dear', 'take Sir']

All Answers

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

Hint:

Use a list comprehension to iterate two lists using a for loop and concatenate the current item of each list.

Solution:

list1 = ["Hello ", "take "]
list2 = ["Dear", "Sir"]

res = [x + y for x in list1 for y in list2]
print(res)

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

total answers (1)

Given a two Python list. Write a python program to... >>
<< Given a list of numbers. write a program python to...