3 * 3 matrix multiplication
matrix1=[[2]*3] * 3
matrix2=[[10] * 3] * 3
matrix3=[[0] * 3] * 3
print matrix1
print matrix2
for i in range(3):
for j in range(3):
matrix3[i][j]=matrix1[i][j] * matrix2[i][j]
print matrix3
matrix1=[[2]*3] * 3
matrix2=[[10] * 3] * 3
matrix3=[[0] * 3] * 3
print matrix1
print matrix2
for i in range(3):
for j in range(3):
matrix3[i][j]=matrix1[i][j] * matrix2[i][j]
print matrix3
No comments:
Post a Comment