“Matriz inverso de Python” Código de respuesta

Cómo revertir la matriz en Python

a = [1,2,3,4]
a = a[::-1]
print(a)
>>> [4,3,2,1]
Helpless Hyena

Lista inversa Python

>>> the_list = [1,2,3]
>>> reversed_list = the_list.reverse()
>>> list(reversed_list)
[3,2,1]

OR

>>> the_list = [1,2,3]
>>> the_list[::-1]
[3,2,1]
Thoughtful Trout

Matriz inverso de Python

# method 1
arr = [11, 22, 33, 44, 55]
res = arr[::-1]
print("Reversed array:",res) #Reversed array: [5, 4, 3, 2, 1]

#method 2
arr = [11, 22, 33, 44, 55]
arr.reverse()
print("After reversing Array:",arr) #After reversing Array: [55, 44, 33, 22, 11]

#method 3
arr = [12, 34, 56, 78]
result=list(reversed(arr))
print("Resultant new reversed Array:",result) #Resultant new reversed Array: [78, 56, 34, 12]
Edoardo Balducci

Cómo revertir la matriz en Python

>>> L = [0,10,20,40]
>>> L[::-1]
[40, 20, 10, 0]
Helpless Hyena

revertir una matriz pyton

array=[0,10,20,40]
reversed_array=array[::-1]
Tremendous Enceladus

Matriz inverso de Python

array = [1, 2, 3, 4, 5]

reverse_array = array[::-1]
Darrin Haase

Respuestas similares a “Matriz inverso de Python”

Preguntas similares a “Matriz inverso de Python”

Más respuestas relacionadas con “Matriz inverso de Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código