I know that to generate a list in Python you can use something like:
l = [i**2 for i in range(5)]
instead of using for loop like:
l = []
for i in range(5):
l.append(i**5)
Is there a way to do 2D lists without using for loops like this:
map = [[]]
for x in range(10):
row = []
for y in range(10):
row.append((x+y)**2)
map.append(row)
Is there any other alternatives to represent 2D arrays in Python ?