SZanlongo
9/18/2014 - 1:59 AM

2D Matrix

2D Matrix

# https://stackoverflow.com/questions/691946/short-and-useful-python-snippets
# Create 2-dimensional matrix
lst_2d = [[0] * 3 for i in xrange(3)]
print lst_2d

# Assign a value within the matrix
lst_2d[0][0] = 5
print lst_2d