I am trying to sum the product of two different list items in the same line using for loop, but I am not getting the output as expected.
My example code:
a = [1,2,3]
b = [4,5,6]
sum = 0 # optional element
score = ((sum+(a(i)*b(i)) for i in range(len(a)))
print score
output:
<generator object <genexpr> at 0x027284B8>
expected output:
32 # 0+(1*4)+(2*5)+(3*6)