“Rotar la matriz 90 grados en el sentido de las agujas del reloj Python” Código de respuesta

Rotar la matriz 90 grados en el sentido de las agujas del reloj Python

#rotate 90 deg clockwise
box=[["a","b"],["c","d"],["e","f"]]

rows = len(box)
cols = len(box[0])

box2 = [[""] * rows for _ in range(cols)]

for x in range(rows):
    for y in range(cols):
        box2[y][rows - x - 1] = box[x][y]
Thoughtless Tiger

Gire 90 grados en el sentido de las agujas del reloj Python

new_matrix = [[m[j][i] for j in range(len(m))] for i in range(len(m[0])-1,-1,-1)]
Successful Squirrel

Gire la matriz 90 grados en el sentido de las agujas del reloj en Python

#The program defines the square matrix 90 degrees clockwise direction.
m,n  = map(int,input().split())
#m,n are the number of rows and columns.
#m = int(input('rows'))
l = []
for i in range(m):
	x = list(map(int,input().split()))  #for taking the  rows a time and split it append to an empty list		
	l.append()
for i in range(m):
	for j in range(m-1,-1,-1):
		print(l[j][i],end=' ')
	print(end='\n')
LINGALA HANUMANTHA REDDY

Respuestas similares a “Rotar la matriz 90 grados en el sentido de las agujas del reloj Python”

Preguntas similares a “Rotar la matriz 90 grados en el sentido de las agujas del reloj Python”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código