Thursday, January 17, 2013

Matrix in python

There are no inbuilt function for define matrix. You can define the matrix as a list of list as follow


table= [ [ 0 for i in range(6) ] for j in range(6) ]
print table


result

[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]

0 comments:

Post a Comment