Why dose this program return none and not run through the algorithum


#1

I am useing the markov chain algorithum in the final project but when I run this program it returns none, but the file is not blank.

Here is my code

from markov_python.cc_markov import MarkovChain


f= open('html.txt','r')
mc = MarkovChain(f)


print mc.add_string(f.read())

#2

Hi @coder585 ,

Because the code that you posted is not formatted, it is difficult for other users to read and debug it. After code has been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. Alternatively, you can place three backquotes on the line before the code and three backquotes on the line after the code. This will enable us to see important details, such as the indentation and underscores. If you use the backquotes, your code will be color-coded, making it especially easy to read.

You have ...

from markov_python.cc_markov import MarkovChan

... but check the spelling. The instructions on this GitHub page, regarding How to add this to your project have you do this ...

from markov_python.cc_markov import MarkovChain