The reverse() method replaces the reverse list object.
grammatical
The following is the syntax of the reverse() method:
()
parameters
- NA
return value
This method does not return any value, but inverts the given object in the list.
(for) instance
The following example shows the use of the reverse() method.
#!/usr/bin/python aList = [136, 'xyz', 'zara', 'abc', 'xyz','hema']; (); print "List : ", aList;
When we run the above program, it produces the following results:
List : ['hema','xyz', 'abc', 'zara', 'xyz', 126]