We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Luke Foord • 2 years ago

I'm getting this error:

Traceback (most recent call last):
File "C:\Users\Luke\Desktop\New folder\markov_chain.py", line 48, in <module>
load(r'C:\Users\Luke\Desktop\New folder\sentences.txt')
File "C:\Users\Luke\Desktop\New folder\markov_chain.py", line 26, in load
add_message(line)
File "C:\Users\Luke\Desktop\New folder\markov_chain.py", line 33, in add_message
couple_words[(words[-2], words[-1])].put("")
IndexError: list index out of range

Could anyone offer assistance? I don't understand what the code is doing, so it is a little difficult to understand why it is throwing an error.
All I have changed is the path to sentences.txt

drjpooch • 4 years ago

I was getting an error on Line 48.... but I finally figured it out.

First, I needed to change "sentences.txt" to a filepath with my own text file, but then I was still receiving an error

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3

. I websearched the error and realized I needed to add an 'r' before my filepath. My updated line 48 is:

load(r'C:\Users\drjpooch\Desktop\sentences.txt')

Thanks for this article. :)

rtankgames • 4 years ago

I figure the puzzle out you just have to input the values to the code. also figure out what the quote is.

Anonymous • 4 years ago

wow

Anonymous • 4 years ago

I need help I have no clue what do plz help

rtankgames • 4 years ago

Just simply input the code that is above page and your output should be a quote