Vertical concatenation in matrix using loop

sample_list = [["Hi", "python"], ["welcome", "for"], ["to","engineers"]]

print("The original list : " + str(sample_list))

res = []

N = 0

while N != len(sample_list):

temp = ''

for idx in sample_list:

try: temp = temp + idx[N]

except IndexError: pass

res.append(temp)

N = N + 1

res = [ele for ele in res if ele]

print("List after column Concatenation : " + str(res))


No comments: