>>> l = [[1, 2, 3], [4, 5, 6], [7], [8, 9]] >>> sum(l, []) [1, 2, 3, 4, 5, 6, 7, 8, 9]
length, breadth = x, y matrix = [[-1 for j in range(breadth)] for i in range(length)] # every element is -1