Method Name:
reverse
Method Signature:
reverse()
Method Overview:
- This method reverses the ordering of the elements in a Python list object.
Parameters and return value:
Reversing of operation happens in-place and the method does not return any value.
Example:
# Example Python program that reverses the order of elements print(cityList) print("List of cities in reverse order:"); |
Output:
List of cities: ['Dublin', 'London', 'Paris', 'Brussels', 'Amsterdam', 'Berlin', 'Warsaw'] List of cities in reverse order: ['Warsaw', 'Berlin', 'Amsterdam', 'Brussels', 'Paris', 'London', 'Dublin'] |