Skip to content

Commit 6d5fc46

Browse files
Create verticalConcatenationMatrix
1 parent 3fb871e commit 6d5fc46

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

verticalConcatenationMatrix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# initializing lists
3+
test_list = [["Gfg", "good"], ["is", "for"], ["Best"]]
4+
5+
# printing original list
6+
print("The original list : " + str(test_list))
7+
8+
# using loop for iteration
9+
res = []
10+
N = 0
11+
while N != len(test_list):
12+
temp = ''
13+
for idx in test_list:
14+
15+
# checking for valid index / column
16+
try: temp = temp + idx[N]
17+
except IndexError: pass
18+
res.append(temp)
19+
N = N + 1
20+
21+
res = [ele for ele in res if ele]
22+
23+
# printing result
24+
print("List after column Concatenation : " + str(res))

0 commit comments

Comments
 (0)