Page 141 - Code_GPT_Class_8
P. 141

3.  A list within a list is called nested list. Cite an example of nested List.

                                  a. name=[‘Meenu’, ‘Cheenu’]                   b. age=[14, 56, 23]

                                  c. address=[‘Delhi’, 12’, ‘Noida’]            d. marks=[‘Ajay’,[99,98,97,96], ‘Jiten’, 98]

                        4.  Which function is used to add an element in a list?

                                  a. extend()                                   b. count()

                                  c. append()                                   d. add()

                        5.  Negative indexing of lists starts from           .
                                  a. 0                                          b. 1


                                  c. –1                                         d. —len(list)



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


                        1.  Slicing lists implies accessing the list elements within a specific range.

                        2.  List function index() returns the index of the last element of the list.


                        3.  Syntax of slicing the list is: <name of the list>[stop : start : step]

                        4.   Lists are mutable, which means the elements of a list can be changed without allocating
                           new storage location.


                        5.  L1={‘Hyundai’, ‘Toyota’, ‘Maruti’} is a valid list.


                        Fill in the blanks with the correct words.



                                                Hints  different types,  count(),  reverse(),  +,  [ ],  *


                        1.  List is used to store the sequential order of          of data.
                        2.   List function             returns the occurrence (number of times) of a particular element in the
                           list.
                        3.                function reverses the order of the elements in the list.

                        4.                 operator is  used  to  join  two  lists  and         operator is  used  to  repeat
                           the list.

                        5.  An empty list can be created by assigning            to a variable.



                  Q     Answer the following questions:
                    A
                       1.  What is a list in Python?






                                                                                                   List in Python  139
   136   137   138   139   140   141   142   143   144   145   146