結果 : how to loop through a matrix in python