Saturday, March 24, 2018

List reverse( ) Method


List reverse( ) Method

 The reverse() method reverses objects of list in place.

Syntax

list.reverse()


Return Value
This method does not return any value but reverse the given object from the list.
Example
#!/usr/bin/python3

list1 = ['physics', 'Biology', 'chemistry', 'maths']
list1.reverse()
print ("list now : ", list1)

When we run above program, it produces following result
list now : ['maths', 'chemistry', 'Biology', 'physics']



<<< remove( )                   Go to Index                           sort( ) >>>