Skip to content

Commit 417d938

Browse files
Added Exercise 18
1 parent 271f962 commit 417d938

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
""" Concatenate two lists in the following order """
2+
# Given :-
3+
# list1 = ["Hello ", "take "]
4+
# list2 = ["Dear", "Sir
5+
# Expected Output:- ['Hello Dear', 'Hello Sir', 'take Dear', 'take Sir']
6+
7+
# Hints:- Use a list comprehension to iterate two lists using a for loop and concatenate the current item of each list.
8+
9+
list1 = ["Hello ", "take "]
10+
list2 = ["Dear", "Sir"]
11+
12+
result = [x + y for x in list1 for y in list2]
13+
print(result)

0 commit comments

Comments
 (0)