首页 > 代码库 > 算法基础之2维数组90度旋转

算法基础之2维数组90度旋转

data=http://www.mamicode.com/[[col for col in rang(4)] for row in rang(4)]

 

for row in data:

print(row)

print("-------------------------------------------")

for r_index, row in enumerate(data):

  

  for c_index in range (r_index ,len(row)):

    temp=data[c_index][r_index]

    date[c_index][r_index]=row[c_index]

    data[r_index][c_index]=temp

print("-----------------")

  for r in data:print(r)

 

算法基础之2维数组90度旋转