Method Name:
reverse
Method Signature:
reverse()
Method Overview:
- reverse() reverses the sequence of elements present in a python deque object.
- reverse()method returns None.
Example:
import collections
elems = (2, 6, 12, 20) dequeObject = collections.deque(elems) print("Deque object before reversal:") print(dequeObject)
retVal = dequeObject.reverse()
print("Deque object after reversal:") print(dequeObject) |
Output:
Deque object before reversal: deque([2, 6, 12, 20]) Deque object after reversal: deque([20, 12, 6, 2]) |