Page 132 - Trackpad_V5_Book 8
P. 132

Program 17: To add elements to an existing list using extend() function:









            You will get the following output:













            The del( ) Function

            We use the del( ) function to remove a sublist (start : stop : step) or a whole list of elements.
            Syntax for using del() function is:

                del list_name(start : stop : step)
            Program 18: To delete elements from the list.










            You will get the following output:











            Program 19: To delete the whole list:












                 Tick ( ) if you know this.

                 ▶   A consecutive sequence of characters that are enclosed or surrounded by a single (‘ ’) or
                   double (“ ”) quotes is known as a string.
                 ▶  A list is a type of container that is used to store a list of values of any type.





            130   Pro (Ver. 5.0)-VIII
   127   128   129   130   131   132   133   134   135   136   137