Week 1 Assignment 2 Exercise 4 - Final loss and dinosaur names are wrong

The final loss figure and dinosaur names for Exercise 4 do not match the expected results.
The first three exercises work as expected and I get the 'All tests passed!" message and marks by the auto grader.

But for the 4th Exercise, I get wrong results. I am pasting some of the output from Exercise 4.

j =  0 idx =  0
single_example = aachenosaurus
single_example_chars ['a', 'a', 'c', 'h', 'e', 'n', 'o', 's', 'a', 'u', 'r', 'u', 's']
single_example_ix [1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19]
 X =  [None, 1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19] 
 Y =        [1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19, 0] 

Iteration: 0, Loss: 23.093932

Nkzxwtdmeqoeyhsqwasjjjvu
Kneb
Kzxwtdmeqoeyhsqwasjjjvu
Neb
Zxwtdmeqoeyhsqwasjjjvu
Eb
Xwtdmeqoeyhsqwasjjjvu


j =  1535 idx =  1535
j =  1536 idx =  0
Iteration: 2000, Loss: 26.681733

Iiytronheoravhoss
Eola
Eytosaurus
Idaahosalaus
Xuskeonoraveros
Cdalosan
Tosaurus

......
......
......

Iteration: 22000, Loss: 20.578871

Hutusaurus
Euca
Eustrioppn
Hocamptopanceus
Xuspeodon
Elacropechus
Uspeodon

Expected Result

Expected output

...
Iteration: 22000, Loss: 22.728886

Onustreofkelus
Llecagosaurus
Mystolojmiaterltasaurus
Ola
Yuskeolongus
Eiacosaurus
Trodonosaurus

My X and Y calculations seem to be correct for j=0, idx=0.
It’s only a few lines of code to be implemented by us and I am unable to figure where I am going wrong.

Thanks in Advance,
RS

Please click my name and message your notebook as an attachment.

Balaji, Done.

Thank You

You’re welcome. Please fix initialization of single_example. Do read the markdown again for more hints.

Thank You! How silly of me.