while trying to print multiple rows and columns using list comprehensions, the following code works
X=[[x for x in range(y)] for y in range(3)]
but this code does not work
X=[x for x in range(y) for y in range(3)]
What difference it makes when list is used instead of direct loop. Generally for multiple loops it works from left to right. in this case the loops are working from right to left so we able to use y before y is declared in for .