“Lista odwrotna metoda w Pythonie” Kod odpowiedzi

Odwrotna lista 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

Odwrotna lista Python

my_list = [1, 2, 3, 4, 5, 6]
# Reverse a list by using reverse() method -- inplace reversal
my_list.reverse()
print(my_list)
Average Anteater

Lista odwrotna metoda w Pythonie

l1 = [1, 8, 7, 2, 21, 15]

 l1.reverse() # reverses the list
  
  print(l1)
  
  #it will reverse the list
Coding boy Hasya

Odwróć listę w Pythonie

a = ['a', 'b', '4', '5', 'd'] #reverse the List
print(list(reversed(a)))
tymepas

Odpowiedzi podobne do “Lista odwrotna metoda w Pythonie”

Pytania podobne do “Lista odwrotna metoda w Pythonie”

Więcej pokrewnych odpowiedzi na “Lista odwrotna metoda w Pythonie” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu