Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
644 B
4
Indexable
Never
k1, w1 = input().split()
k1 = int(k1)
w1 = int(w1)
m1=[]
for i in range (w1):
    wiersz=[int(x)for x in input().split()]
    m1.append(wiersz)
#print(m1)
#print(m1[0][1])
k2, w2 = input().split()
k2 = int(k2)
w2 = int(w2)
m2=[]
for i in range (w2):
    wiersz=[int(x)for x in input().split()]
    m2.append(wiersz)
#print(m2)

def multiplication(m1,m2):
    result = [[0]*len(m2[0]) for _ in range (len(m1))]
    for s in range(len(m1)):
        for j in range(len(m2[0])):
            for k in range(len(m2)):
                result[s][j] += m1[s][k] * m2[k][j]
    for i in (result):
        print (i)
    return result
multiplication(m1,m2)
Leave a Comment