Wrong Result generated in Lyrics Challenge Markov Chain

The link to my code is given below:


Please tell where I am doing wrong, since the same statement is repeated in all lines and accuracy is only 2%.

Hello @Anubhav-Sanyal-2376201725990648,

Sorry for the delay as I had to submit the challenge myself to see what is the problem.
Firstly, dont do np.random.seed(11) everytime you predict a choice. Do it only once in the whole program, we need to only seed it only once, at the very beginning, if you think a bit you will know why only two statements kept on repeating (you seeded everytime with the same value :wink: ). Also, try reading and writing the file in this way,

with open(file_path, encoding="UTF-8")

it’s only because you have a character in the file that is only recognized under “UTF” encoding. Also, you need to generate 2000 characters, not 1996. The 2000 characters in excluding “apna”.

Happy Learning :slight_smile:
Thanks

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.