Stuck on Sampling Programming Exercise

I am on Exercise UNQ_C2

my Y variable comes out to be a (27,27) matrix and when I try the following:

idx = np.random.choice(range(len(y.ravel())), p = y.ravel())

I get:

ValueError: probabilities do not sum to 1

y should be of shape (27, 1). Please check your calculations.