Simple markov chain implementation in python