Page 75 - Modular v1.1 Pyhton
P. 75

index( )     Returns the index of first element of the list
                       count( )     Returns the occurrence (number of times) of a particular element in the list

                       pop([i])     Removes and returns item at the ‘i’ location in the list

                       copy( )      Returns a copy of the list
                       clear( )     Removes all the elements from the list and returns an empty list
                       sort( )      Sorts all the elements in the list

                       reverse( )   Reverses the order of the elements in the list

                 Program 6: Python built-in methods.


























                 On running the above program, you will get the following output:




















                  Clickipedia



                   The ‘+’ operator when used with lists needs both the operands to be of list type, otherwise
                   it will produce an error.


                     PYTHON FUNCTIONS

                 Python also provides various built-in Python list functions. The following table describes various
                 Python built-in functions.

                                                                                                 List in Python   73
   70   71   72   73   74   75   76   77   78   79   80