mein code sieht bis jetzt so aus :
Code: Alles auswählen
def mult_matrix_vector(A, b):
"""
returns the product of matrix A and vector x
Parameter A: a list of lists, representing the column vectors of A
Precondition: A is a list of lists of floats
Parameter x: the vector x
Precondition: x is a list of floats
"""
assert(len(A)==len(b))
r=[]
for j in range(len(b)):
sum = 0
for i in range(len(b)):
sum = sum + A [i] [j] * b [i]
r.append(sum)
return r
mult_matrix_vector( [ [1,2,3],[1,2,3] ] ,[ 4,5 ] ) == [ 9, 18, 27 ]
aber mit meinem code bekomme ich nur [ 9, 18 ]
könnte mir jemand weiterhelfen?