I kept all the matrixes. I only changed positions of matrixes in the file. Now every thing works well. Here is the new code:...
#file9.py
from pprint import pprint
print("MULTIPLICATION TABLE")
def pause():
input("Press ENTER to continue")
M = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
print("New values in the matrix")
for i in range(len(M)):
for j in range(len(M)):
M[i][j] = i * j
pprint(M)
pause()
print("This multiplication_table 'N' is a matrix beginning by a 1")
N = []
for x in range(1, 10):
new_row = []
for y in range(1, 10):
new_row.append(x * y)
N.append(new_row)
pprint(N)
pause()
print("\nNow a display of the same, row by row")
for row in N[0:]: # begin by item 0
print(row[0:]) # begin by item 0
pause()
print("The following 'P' is a matrix")
P = [[x * y for y in range(1, 10)] for x in range(1, 10)]
pprint(P)
pause()
print("\nNow action between the 2 matrixes 'M', beginning with a 0, and 'N' with a 1 ")
print([M[row][col] * N[row][col] for row in range(5) for col in range(5)])
print("second action")
print([[M[row][col] * N[row][col] for row in range(5)] for col in range(5)])
pause()
print("New 'P' in a square")
for i in range(len(P)):
for j in range(len(P)):
if len(str(P[i][j])) == 1:
P[i][j] = " " + str(P[i][j])
else:
P[i][j] = str(P[i][j])
for x in range(len(P)):
print(P[x])
exit()