Explore Library
Code QuizIntermediate

Reshaping a Flat Array

Spot the bug when reshaping a 6-element array into a 2x3 matrix.

Codepython
import numpy as np

a = np.arange(6)  # [0 1 2 3 4 5]
# We want a 2-row, 3-column matrix
m = a.reshape(3, 2)
print(m.shape)

What is the bug in this code?