我必须在 5x5 数组中打印此 python 代码,该数组应如下所示:
0 1 4 (infinity) 3
1 0 2 (infinity) 4
4 2 0 1 5
(inf)(inf) 1 0 3
3 4 5 3 0
谁能帮我打印这张表?使用索引。
for k in range(n):
for i in range(n):
for j in range(n):
if A[i][k]+A[k][j]<A[i][j]:
A[i][j]=A[i][k]+A[k][j]