# vector v
v = [1,2,-3]
# vector u
u=[-2,3]

vu = []

for i in range(len(v)): # each element of v will be replaced
    for j in range(len(u)): # the vector u will come here after multiplying with the entry there
        vu.append( v[i] * u[j] )

print("v=",v)
print("u=",u)
print("vu=",vu)

#
# your solution is here
#
u = [-2,-1,0,1]
v = [1,2,3]

uv = []
vu = []


for i in range(len(u)): # one element of u is picked
    for j in range(len(v)): # now we iteratively select every element of v
        uv.append(u[i]*v[j]) # this one element of u is iteratively multiplied with every element of v 
    
print("u-tensor-v is",uv)    

for i in range(len(v)): # one element of v is picked
    for j in range(len(u)): # now we iteratively select every element of u
        vu.append(v[i]*u[j]) # this one element of v is iteratively multiplied with every element of u 
    
print("v-tensor-u is",vu)    

# matrix M
M = [ 
    [-1,0,1],
    [-2,-1,2],
    [1,2,-2]
]

# matrix N
N = [
    [0,2,1],
    [3,-1,-2],
    [-1,1,0]
]

# MN will be a (9x9)-dimensional matrix
# prepare it as a zero matrix
# this helps us to easily fill it 
MN=[]
for i in range(9):
    MN.append([])
    for j in range(9):
        MN[i].append(0)

for i in range(3): # row of M
    for j in range(3): # column of M
        for k in range(3): # row of N
            for l in range(3): # column of N
                MN[i*3+k][3*j+l] = M[i][j] * N[k][l] 

print("M-tensor-N is")                
for i in range(9):
    print(MN[i])

# matrices M and N were defined above

# matrix NM will be prepared as a (9x9)-dimensional zero matrix
NM=[]
for i in range(9):
    NM.append([])
    for j in range(9):
        NM[i].append(0)

for i in range(3): # row of N
    for j in range(3): # column of N
        for k in range(3): # row of M
            for l in range(3): # column of M
                NM[i*3+k][3*j+l] = N[i][j] * M[k][l] 

print("N-tensor-M is")
for i in range(9):
    print(NM[i])

#
# your solution is here
#
A = [
    [-1,0,1],
    [-2,-1,2]
]

B = [
    [0,2],
    [3,-1],
    [-1,1]
]

print("A =")
for i in range(len(A)):
    print(A[i])

print() # print a line
print("B =")
for i in range(len(B)):
    print(B[i])

# let's define A-tensor-B as a (6x6)-dimensional zero matrix
AB = []
for i in range(6):
    AB.append([])
    for j in range(6):
        AB[i].append(0)

    
        
# let's find A-tensor-B
for i in range(2):
    for j in range(3):
        # for each A(i,j) we execute the following codes
        a = A[i][j]
        # we access each element of B
        for m in range(3):
            for n in range(2):
                b = B[m][n]
                # now we put (a*b) in the appropriate index of AB
                AB[3*i+m][2*j+n] = a * b
    
    

print() # print a line
print("A-tensor-B =") 
print() # print a line
for i in range(6):
    print(AB[i])

#
# your solution is here
#
A = [
    [-1,0,1],
    [-2,-1,2]
]

B = [
    [0,2],
    [3,-1],
    [-1,1]
]

print() # print a line
print("B =")
for i in range(len(B)):
    print(B[i])
    
print("A =")
for i in range(len(A)):
    print(A[i])

# let's define B-tensor-A as a (6x6)-dimensional zero matrix
BA = []
for i in range(6):
    BA.append([])
    for j in range(6):
        BA[i].append(0)
        
# let's find B-tensor-A
for i in range(3):
    for j in range(2):
        # for each B(i,j) we execute the following codes
        b = B[i][j]
        # we access each element of A
        for m in range(2):
            for n in range(3):
                a = A[m][n]
                # now we put (a*b) in the appropriate index of AB
                BA[2*i+m][3*j+n] = b * a
    
    

print() # print a line
print("B-tensor-A =") 
print() # print a line
for i in range(6):
    print(BA[i])