Explore Library
Code QuizIntermediate

Vector Dot Product

Find why this dot product function adds instead of computing products.

Codepython
def dot(a, b):
    result = 0
    for i in range(len(a)):
        result += a[i] + b[i]
    return result

print(dot([1, 2, 3], [4, 5, 6]))  # expected 32

What is the bug in this dot product implementation?