Answers for "what is the reverse function in list"

55

reverse list 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]
Posted by: Guest on February-11-2020
2

reverse list python

my_list = [1, 2, 3, 4, 5, 6]
# Reverse a list by using reverse() method -- inplace reversal
my_list.reverse()
print(my_list)
Posted by: Guest on March-06-2021
-1

reverse() in python

# Operating System List
systems = ['Windows', 'macOS', 'Linux']
print('Original List:', systems)

# List Reverse
systems.reverse()

# updated list
print('Updated List:', systems)
Posted by: Guest on May-06-2021

Code answers related to "what is the reverse function in list"

Python Answers by Framework

Browse Popular Code Answers by Language