Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
328 B
1
Indexable
Never
def create_diagonals(objects, backgrounds):
    n = len(objects)
    diagonals = [[] for _ in range(2*n-1)]
    for i in range(n):
        for j in range(n):
            diagonal_index = i-j+n-1
            diagonals[diagonal_index].append(objects[i] + '_' + backgrounds[j])
    return [d for d in diagonals if len(d)==4]