Page 139 - TP_Play_V2.2_Class8
P. 139

5.  Which of the following methods is used to add one element to the list?

                                 a.  append( )                                 b.  extend( )

                                 c.  insert(x, a)                              d.  remove( )



                        Fill in the blanks with the correct words.


                                               Hints  mutable, +, element, indexing, specific


                        1.  List is a collection of data elements in a               order.

                        2.  In list, each value is called an               .

                        3.  To access the list elements                  is used.
                        4.   The                    list implies that the elements of a list can be changed or new elements can
                           be added into a list.

                        5.  To join the two lists together                 operator is used.

                         Tick ( ) the correct statements and cross ( ) the wrong ones.


                        1.  Traversing means accessing the elements of a list.

                        2.  The index of elements of a list starts from 1.
                        3.  Nested list can be traversed by using the index operator.

                        4.  Lists are immutable.

                        5.  The extend( ) is used to add more than one element to a list.


                  Q     Answer the following questions:
                    A
                       1.  Define the term list.



                       2.  What is indexing?



                       3.  What do you mean by the term negative indexing?



                       4.   Differentiate between indexing and slicing.





                       5.   Write a program to add element (12, 2, 34, 65)  to the list=[13, 25, 41, 63, 82].









                                                                                                     #List in Python 137
   134   135   136   137   138   139   140   141   142   143   144