A = [
[a1_1, a1_2, ..., a1_W],
[a2_1, a2_2, ..., a2_W],
: : : :
[aH_1, aH_2, ..., aH_W]
]
Matrice A comme celle ci-dessus
At = [
[a1_1, a2_1, ..., aH_1],
[a1_2, a2_2, ..., aH_2],
: : : :
[a1_W, a2_W, ..., aH_W]
]
Il fait référence à une matrice transformée comme At ci-dessus.
displace.py
A = [
[1, 2],
[3, 4],
[5, 6]
]
H = 3
W = 2
At = [[A[i][j] for i in range(H)] for j in range(W)]
print(*A, sep="\n")
print("")
print(*At, sep="\n")
> displace.py
[1, 2]
[3, 4]
[5, 6]
[1, 3, 5]
[2, 4, 6]
Succès.
Recommended Posts