I'm making a 2D list and I would like to initialize it with a list comprehension. I would like it to do something like this:
[[x for i in range(3) if j <= 1: x=1 else x=2] for j in range(3)]
so it should return something like:
[[1,1,1],
[1,1,1],
[2,2,2]]
How might I go about doing this?
Thanks for your help.