Page 116 - Trackpad_V2.1_class8
P. 116

upper(): The upper() function  converts all  lowercase  letters  to  uppercase.  Syntax  of using

                    upper() function is:

                    string_name.upper()
                     capitalize(): The capitalize() function returns a string with the first character in capital. Syntax
                    of using capitalize() function is:

                    string_name.capitalize()
                  Program 10: To use various string built-in functions


                      Program10.py
                   File  Edit  Format    Run   Options   Window    Help

                   str = 'Hello'
                   print(len(str))
                   print('Hello'.lower())
                   print('hello'.upper())
                   print('hello'.capitalize())





                      Output
                   5
                   hello
                   HELLO
                   Hello







                                           1.  What is a string?
                                             ______________________________________________________________
                          uiz   Bee        2.  What are escape sequences?

                                             ______________________________________________________________








                            LIST

                  In Python, a list is a type of container that is used to store a list of values of any type. One can
                  store an integer, string as well as objects in a single list. Each element in a list is assigned an index
                  number. The first index is 0, the second index is 1, the third is 2, and so on.

                  CREATING A LIST

                  Lists can be created by inserting the elements in square brackets []. The elements in the list are
                  separated by a comma.



                   114  Trackpad (V2.1)-VIII
   111   112   113   114   115   116   117   118   119   120   121