Python如何进行矩阵翻转?
发布网友
发布时间:2022-04-25 12:00
我来回答
共2个回答
热心网友
时间:2024-07-12 00:18
>>> a=1,2,3,4,5
>>> b=6,7,8,9,10
>>> c=11,12,13,14,15
>>> d=16,17,18,19,20
>>> e=21,22,23,24,25
>>> f=map(int,a)
>>> g=map(int,b)
>>> h=map(int ,c)
>>> i=map(int,d)
>>> j=map(int,e)
>>> print(list(zip(a,b,c,d,e)))
[(1, 6, 11, 16, 21), (2, 7, 12, 17, 22), (3, 8, 13, 18, 23), (4, 9, 14, 19, 24), (5, 10, 15, 20, 25)]
热心网友
时间:2024-07-12 00:19
a1=[]
a1=input().split()
n=int(a1[0])
m=int(a1[1])
a2=[]
a3=[]
a4=[]
for w in range(n):
a2=input().split()
a3=a3+a2
for x in range(m):
for y in range(n-1,-1,-1):
z=y*m+x
a4.append(a3[z])
for h in range(m):
for i in range(n):
j=h*n+i
print(a4[j],end=" ")
print(" ")