Program - python program for vertical concatenating of mqatrix


Topic: Program - python program for vertical concatenating of mqatrix

Solution

def vertical_concatenation():
    test_list = [["this","is"], ["program", "for"], ["vertical","concatenation"]]
    print("The original list : " + str(test_list))
    res = []
    N = 0
    while N != len(test_list):
        temp = ''
        for idx in test_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))
vertical_concatenation()



List all Python Programs