import numpy as np P = np.matrix( '0.4, 0.3, 0.1; \ 0.4, 0.3, 0.6; \ 0.2, 0.4, 0.3' ) print( P ) x0 = np.matrix( '0; \ 1; \ 0' ) print( x0 ) x1 = P * x0 print( x1 ) x2 = P * x1 print( x2 ) x = x0 for i in range( 21 ): # you saw range( n ) in Week 1 print( 'Day', i ) # print the predictions for day i print( x ) x = P * x # compute the predictions for day i+1