Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 155 - 2620_Birla Open Mind C-8
P. 155

    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( )

                     B.    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.

                     C.      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.

                     D.  Answer the following questions:

                           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 153

| 150 151 152 153 154 155 156 157 158 159 160 |