C5W1 A2 range error


Does anyone know why “range take not key word argument”?

Does anyone know what “probabilities do not sum to 1 mean?”

There are a couple of problems in your use of np.random.choice().
The first argument should be the range of the vocab_size variable.
The second argument should use ravel() on y. Casting p as an np.array() of y isn’t correct.

1 Like

Re: probabilities not summing to 1.
Fixing the call to np.random.choice() should fix that error.

thank you so much!!! But I don’t know why now I keep getting the wrong values


Is it because I overwrite x wrongly at step 4?

I cannot tell what the problem is in your code from just the assert message.

Thank you!!! I got it right now :heart: