reverse() method reverse the positions of elements of list
« All list methods
reverse() takes no arguments .
Returns a copy of the main list with positions of elements reversed .
my_list=['a','b','c','d','x','y','z']
my_list.reverse()
print(my_list)
Output
['z', 'y', 'x', 'd', 'c', 'b', 'a']
« All list methods « Questions with solutions on List
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com