1# Using above second method to create a
2# 2D array
3rows, cols = (5, 5)
4arr = [[0 for i in range(cols)] for j in range(rows)]
5print(arr)
6
1x = [[foo for i in range(10)] for j in range(10)]
2# x is now a 10x10 array of 'foo' (which can depend on i and j if you want)