Data analysis labNumPy problems

Problem 23 of 50 · Broadcasting · Medium

An outer sum

Add every item of one vector to every item of another.

Preparing NumPy, Pandas, and MatplotlibShift+Enter runs the cell you are in.

a is [1, 2, 3] and b is [10, 20]. Print a 3 by 2 table of every sum a[i] + b[j]. Give a a new axis with a[:, None] so it becomes a column.

1

Your solution

2

Scratch