python
why it say that list index out of bound???there is an error in product(),can u please help me?
Code:
def readmat(r,c):
for i in range(r):
list=[]
str=raw_input()
templist=str.split()
raw=map(int,templist)
list.append(raw)
return list
def product():
list=[]
for i in matA:
sublist=[]
print i[3],matB[1][1]
for x in range(3):
sum=0
for e in range(4):
sum+=i[e]*matB[e][x]
sublist.append(sum)
list.append(sublist)
return list
def display(list):
for r in list:
for c in r:
print c,
print''
print 'enter A'
matA=readmat(3,4)
print 'enter B'
matB=readmat(4,3)
display(product())
Comment