Page 67 - tp_Modula_v2.0
P. 67

On running the above program, you will get the following output:

                     Output

                  Orange Education



                 Empty String


                 An empty string is a string having length zero, i.e. a string without having any character. When
                 we print an empty string, a blank space gets displayed in the next line.

                 Program 2: To create an empty string.
                     Program2.py
                  File  Edit  Format  Run   Options   Window    Help

                  str = " "
                  print(str)



                 On running the above program, you will get the following output:

                     Output






                 Multiline String

                 A multiline string are represented by using either three single quotes or three double quotes.

                 Any quotes, tabs, or newlines inside the “triple quotes” are considered as a part of the string.
                 Program 3: To print multiline strings.

                     Program3.py
                  File  Edit  Format  Run   Options   Window    Help

                  print('''A sequence of characters which
                     is enclosed by single (' ')
                      or double (" ") quotes is
                       known as a string. ''')



                 On running the above program, you will get the following output:

                     Output

                  A sequence of characters which
                     is enclosed by single (' ')
                      or double (" ") quotes is
                       known as a string.





                                                                                      String Handling in Python   65
   62   63   64   65   66   67   68   69   70   71   72