reverse() is an inbuilt method in Python programming language that reverses objects of list in place.
There are no parameters
The reverse() method does not return any value but reverse the given object from the list.
[6, 2, 1, 4, 3, 2, 1] ['a', 'a', 'd', 'c', 'b', 'a']
When anything other than list is used in place of list, then it returns an AttributeError
Traceback (most recent call last): File "/home/b3cf360e62d8812babb5549c3a4d3d30.py", line 5, in string.reverse() AttributeError: 'str' object has no attribute 'reverse'
Given a list of numbers, check if the list is palindrome.
Note: palindrome-sequence that reads the same backwards as forwards
- Python | Pandas Reverse split strings into two List/Columns using str.rsplit()
- Reverse a linked list
- Reverse first K elements of given linked list
- Reverse a Linked List according to its Size
- Reverse a sublist of linked list
- Reverse a Doubly Linked List | Set-2
- Print Reverse a linked list using Stack
- Reverse a Linked List in groups of given size | Set 1
- Reverse a doubly circular linked list
- Reverse alternate K nodes in a Singly Linked List
- Given a linked list, reverse alternate nodes and append at the end
- Reverse a Doubly Linked List | Set 4 (Swapping Data)
- Print Doubly Linked list in Reverse Order
- C Program to reverse each node value in Singly Linked List
- Reverse a doubly linked list in groups of given size
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.