Explore Library
Code QuizIntermediate

NumPy Broadcasting Rules

Finding why two arrays fail to broadcast in an addition.

Codepython
import numpy as np

A = np.ones((3, 4))
row = np.array([1, 2, 3])   # meant to add to each row

result = A + row
print(result)

What is the bug in this code?