Q:

List of all RGB combination (Python)

I want to make a list of lists.
These lists must contain all the combination (16 milion) of RGB palette.
Something like this:
all_colours = [[0,0,0],[0,0,1],[0,0,2],[0,0,3] ... [255,255,253],[255,255,254],[255,255,255]]

How can I achieve this ?
This is what I have actually, not so much...
rgb = []

for r in range(0, 256):
    rgb.append([r])

print(rgb)

A:

Use list comprehension,
rgb = [[x,y,z] for x in range(256) for y in  range(256) for z in range(256)]
len(rgb) # 16777216 colors

# added square brackets to make all items lists inside main list

