Here’s a list comprehension that is equivalent to your nested loops:
a = [[i * j for j in range(0, y)] for i in range(0, x)]
2
solved How to use list comprehension for the following code? [duplicate]
Here’s a list comprehension that is equivalent to your nested loops:
a = [[i * j for j in range(0, y)] for i in range(0, x)]
2
solved How to use list comprehension for the following code? [duplicate]