Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

merge python list items by index one after one

def mix_patterns(*args):
        arglens = len(args[0])
        for arg in args:
            if len(arg) != arglens:
                return f'All lists must be of same length'
        num = []
        for i in range(arglens):
            for x in range(len(args)):
                num.append(args[x][i])
        return num
print(mix_patterns([2,4,6,8],[1,3,5,7]))
 
PREVIOUS NEXT
Tagged: #merge #python #list #items #index
ADD COMMENT
Topic
Name
3+2 =