@hardikdhuri , I was stuck on this for a while too.
Use print to check the shape of your y. It should be a vector that represents your first output, so if our ‘vocabulary’ is 27 character long, it should be a vector of length 27, or shape of (27,). The probabilities should sum to 1, not 100 so if you have it summing to 99.99999997 then either your random choice is implemented wrong or your y is summing the vocabulary vector over 100 iterations (as was my case).
I stumbled upon this issue as well.
Despite the error that the probabilities don’t sum up to one, this is actually NOT the issue in my case. It was the shape issue with some variables that I forgot to correct/fix all along. I was curious how fixing the shape would fix the “sum not equal to 1” issue. Then I print the sum of y, and it sometimes still has a SUM of 0.99999998 or 1.00000002. But IT PASSED THE TEST REGARDLESS.
Hope this finding helps future learners.