Markov Chains Final Project Micmic-Words


#1

This is my first Python project using Markov Chains and also is my first programming project I have ever done. I am looking for some feedback that can help me improve my coding skills both about this project and in the future.

Here

I am aware that my code is very basic and some might find it boring, but I take it as a plus for being able to set up python and text editor program on my own with only online people (mainly codecademy) help guiding me without any help from any of people I know outside internet or computer.


#2

It’s fine, not much to comment on.

It’s very weird to put a space between print and the following parenthesis, it’s as if you can’t decide on whether print is a function or not. That’s not how you format function calls elsewhere in your code, and if it’s a print statement (python2) then why are there parentheses there at all?

If the intention is to make it compatible between python2 and python3, what you do is to import printfunction from __future__

And then this:

while num_quote != "1" and num_quote != "2" and num_quote != "3" and num_quote != "4" and num_quote != "5":

Put all the possibilities in a list and check whether num_quote's value is in the list instead.

Similar here:

while length < 3 or length > 100: 

There’s a lot of mental overhead in reading that (for me anyway), could instead be:

while length not in range(3, 101):

#3

I do the same thing. I got this behavior from the codecadamy lessons since thats in Python 2. Now that i am using Python 3 i am still doing this since i find it a little easier to read.

I agree that this is not how you call a function tho.


#4

I’ll fix them. I agree, it was kinda weird. At the time I wrote them, it has been a while since the last time before that so I kinda rusty and I was so impatience to finish it. The longer I wait, the more I forget so I wrote whatever came to my mind.

About the

  print 

function with parenthesis, I have to admit that I somehow mix it up when I tested my code after I set up python and text editor in my laptop. Somehow, at the earlier test, I think I did some syntax error there when I attempted to use the function

 print .

I fixed it once by using () and it worked. Maybe I did other syntax error, but somehow the () solved my problem so I used them. And because in python 2 here, we only use “”. I somehow got those two mixed up because I thought it was my text editor problem.

I’ll fix them and have them post later today.

Thank you for the helpful review.


#5

I have just fixed and upload my code in the link at the top. Feel free to check.