Commit c173dd80 by “安晓东”

第7次作业

parent 3f6ee173
def isToeplitzMatri(matrix):
line = len(matrix) - 1 # 行的大小
row = len(matrix[0]) - 1 # 列的大小
for i in range(line):
for r in range(row):
if matrix[i][r] != matrix[i + 1][r + 1]:
return False
return True
matrix = [
[1, 2, 3, 4],
[5, 1, 2, 3],
[9, 5, 1, 2]
]
print(isToeplitzMatri(matrix))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment