Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a=[[1,3,5],[2,4,8],[8,4,7]]
- b=[[4,9,3],[7,4,3],[5,2,1]]
- matriz=[[0,0,0],[0,0,0],[0,0,0]]
- numeros=[]
- count=0
- j=0
- m=0
- while j<len(a)*len(b):
- sum=0
- for i in range (0, len(a)):
- sum+=a[m][i]*b[i][count]
- if j==2 :
- m+=1
- if j==5:
- m+=1
- count+=1
- if count>=3 :
- count=0
- numeros.append(sum)
- j+=1
- cont=0
- for j in range(0,len(a)):
- for m in range(0,len(b)):
- matriz[j][m]=numeros[cont]
- cont+=1
- print("multiplicarlas matrices \n A",a,"\n","y B",b,"\n","es igual a",matriz)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement