numpy matrix assign value code example Example: element assignment numpy matrix import numpy dimensions = (3, 3) a = numpy.zeros(dimensions) a[0, 0] = 1